2017 © Pedro Peláez
 

library async-streams

image

krinfreschi/async-streams

  • Monday, July 28, 2014
  • by krinfreschi
  • Repository
  • 3 Watchers
  • 1 Stars
  • 17 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

##AsyncStreams

A stream wrapper around reactphp for async streams, (*1)

With inspiration from guzzle/streams, (*2)

Installation

This package can be installed easily using Composer. Simply add the following to the composer.json file at the root of your project:, (*3)

{
  "require": {
    "krinfreschi/async-streams": "0.0.*"
  }
}

Then install your dependencies using composer.phar install., (*4)

Global Functions:

async_stream_register_read(resource $handle, callable $callable) //$callable will receive args: $handle
async_stream_remove_read(resource $handle)
async_stream_register_write(resource $handle, callable $callable) //$callable will receive args: $handle, $written, $unwritten
async_stream_remove_write(resource $handle)

Example:

use krinfreschi\AsyncStreams\AsyncStreamWrapper;

require_once "vendor/autoload.php";

$resource = fopen('php://temp', 'r+');
$handle = AsyncStreamWrapper::make($resource);
fwrite($handle, 'data');

async_stream_register_write($handle, function($handle, $written, $unwritten) {
    fseek($handle, 0);
    var_dump(stream_get_contents($handle));
    fclose($handle);
});

AsyncStreamWrapper::run();

The Versions

28/07 2014

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

by Kyle Rinfreschi

27/07 2014

v0.0.3

0.0.3.0

  Sources   Download

MIT

The Requires

 

by Kyle Rinfreschi

27/07 2014

v0.0.2

0.0.2.0

  Sources   Download

MIT

The Requires

 

by Kyle Rinfreschi

26/07 2014

v0.0.1

0.0.1.0

  Sources   Download

MIT

The Requires

 

by Kyle Rinfreschi