Download the PHP package nick4fake/promise-stream-react without Composer

On this page you can find all versions of the php package nick4fake/promise-stream-react. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package promise-stream-react

clue/promise-stream-react Build Status

The missing link between Promise-land and Stream-land, built on top of React PHP.

Table of Contents

Note: This project is in beta stage! Feel free to report any issues you encounter.

Usage

This lightweight library consists only of a few simple functions. All functions reside under the Clue\React\Promise\Stream namespace.

The below examples assume you use an import statement similar to this:

Alternatively, you can also refer to them with their fully-qualified name:

buffer()

The buffer(ReadableStreamInterface $stream) function can be used to create a Promise which resolves with the stream data buffer.

The promise will resolve with all data chunks concatenated once the stream closes.

The promise will resolve with an empty string if the stream is already closed.

The promise will reject if the stream emits an error.

The promise will reject if it is canceled.

first()

The first(ReadableStreamInterface|WritableStreamInterface $stream, $event = 'data') function can be used to create a Promise which resolves once the given event triggers for the first time.

The promise will resolve with whatever the first event emitted or null if the event does not pass any data. If you do not pass a custom event name, then it will wait for the first "data" event and resolve with a string containing the first data chunk.

The promise will reject once the stream closes – unless you're waiting for the "close" event, in which case it will resolve.

The promise will reject if the stream is already closed.

The promise will reject if it is canceled.

all()

The all(ReadableStreamInterface|WritableStreamInterface $stream, $event = 'data') function can be used to create a Promise which resolves with an array of all the event data.

The promise will resolve with an array of whatever all events emitted or null if the events do not pass any data. If you do not pass a custom event name, then it will wait for all the "data" events and resolve with an array containing all the data chunks.

The promise will resolve with an array once the stream closes.

The promise will resolve with an empty array if the stream is already closed.

The promise will reject if the stream emits an error.

The promise will reject if it is canceled.

unwrapReadable()

The unwrapReadable(PromiseInterface $promise) function can be used to unwrap a Promise which resolves with a ReadableStreamInterface.

This function returns a readable stream instance (implementing ReadableStreamInterface) right away which acts as a proxy for the future promise resolution. Once the given Promise resolves with a ReadableStreamInterface, its data will be piped to the output stream.

If the given promise is either rejected or fulfilled with anything but an instance of ReadableStreamInterface, then the output stream will emit an error event and close:

The given $promise SHOULD be pending, i.e. it SHOULD NOT be fulfilled or rejected at the time of invoking this function. If the given promise is already settled and does not resolve with an instance of ReadableStreamInterface, then you will not be able to receive the error event.

unwrapWritable()

The unwrapWritable(PromiseInterface $promise) function can be used to unwrap a Promise which resolves with a WritableStreamInterface.

This function returns a writable stream instance (implementing WritableStreamInterface) right away which acts as a proxy for the future promise resolution. Once the given Promise resolves with a WritableStreamInterface, any data you wrote to the proxy will be piped to the inner stream.

If the given promise is either rejected or fulfilled with anything but an instance of WritableStreamInterface, then the output stream will emit an error event and close:

The given $promise SHOULD be pending, i.e. it SHOULD NOT be fulfilled or rejected at the time of invoking this function. If the given promise is already settled and does not resolve with an instance of WritableStreamInterface, then you will not be able to receive the error event.

Install

The recommended way to install this library is through Composer. New to Composer?

This will install the latest supported version:

See also the CHANGELOG for details about version upgrades.

License

MIT


All versions of promise-stream-react with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3
react/stream Version ^0.4 || ^0.3
react/promise Version ^2.1 || ^1.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nick4fake/promise-stream-react contains the following files

Loading the files please wait ....