2017 © Pedro Peláez
 

library promises

Promises in PHP using pthreads v1.0.0+

image

krakjoe/promises

Promises in PHP using pthreads v1.0.0+

  • Tuesday, December 1, 2015
  • by krakjoe
  • Repository
  • 7 Watchers
  • 63 Stars
  • 35 Installations
  • PHP
  • 0 Dependents
  • 2 Suggesters
  • 6 Forks
  • 0 Open issues
  • 6 Versions
  • 9 % Grown

The README.md

promises

Promises in PHP using pthreads v1.0.0+, (*1)

Promise Manager

The Promise Manager represents a pool of threads used to fulfill promises in parallel., (*2)

The only public API for the PromiseManager is the constructor:, (*3)

public PromiseManager::__construct($size = 4, $worker = \Worker::class, $ctor = [])

See Pool::__construct in the PHP manual., (*4)

Promise

A Promise represents a promise to execute the public interface of a Promisable at some time in the future:, (*5)

public Promise::__construct(PromiseManager $manager, Promisable $promisable)

A Promise provides the ability to schedule the subsequent execution of the public interface of a Thenable., (*6)

public Promise Promise::then(Thenable $then)

Interfaces

IPromisable, (*7)

public void IPromisable::onFulfill();

IThenable, (*8)

public void IThenable::onFulfilled(Promisable $promised);
public void IThenable::onError(Promisable $promised);

Notes

Exceptions thrown by Promisable, or Thenable objects will be caught and bubble up to invoke subsequent Thenable::onError., (*9)

$manager = new PromiseManager();
$promise = 
    new Promise($manager, new CalculateTheMeaningOfLife());
$promise
    ->then(
        new AddTwo($promise))
    ->then(
        new PrintMeaning($promise));

$manager->shutdown();

This is a work in progress

Note that, this is a work in progress, that does not aim for maximum compatibility with any established standard but rather an easy to use implementation, that is compatible with and takes full advantage of pthreads., (*10)

While reading the API, remember everything you read other than PromiseManager is a pthreads object, (*11)

The Versions

01/12 2015

dev-master

9999999-dev http://pthreads.org/

Promises in PHP using pthreads v1.0.0+

  Sources   Download

PHP

The Requires

  • ext-pthreads >=2.0.0

 

pthreads promises

17/11 2015

dev-seven

dev-seven http://pthreads.org/

Promises in PHP using pthreads v1.0.0+

  Sources   Download

PHP

The Requires

  • ext-pthreads >=2.0.0

 

pthreads promises

08/12 2014

v1.0.3

1.0.3.0 http://pthreads.org/

Promises in PHP using pthreads v1.0.0+

  Sources   Download

PHP

The Requires

  • ext-pthreads >=2.0.0

 

pthreads promises

14/03 2014

v1.0.2

1.0.2.0 http://pthreads.org/

Promises in PHP using pthreads v1.0.0+

  Sources   Download

PHP

The Requires

  • ext-pthreads >=2.0.0

 

pthreads promises

09/03 2014

v1.0.1

1.0.1.0 http://pthreads.org/

Promises in PHP using pthreads v1.0.0+

  Sources   Download

PHP

The Requires

  • ext-pthreads >=1.0.0

 

pthreads promises

08/03 2014

v1.0.0

1.0.0.0 http://pthreads.org/

Promises in PHP using pthreads v1.0.0+

  Sources   Download

PHP

The Requires

  • ext-pthreads >=1.0.0

 

pthreads promises