2017 © Pedro PelĂĄez
 

library reactphp-stream

Basic readable and writable stream interfaces that support piping.

image

werkint/reactphp-stream

Basic readable and writable stream interfaces that support piping.

  • Monday, December 5, 2016
  • by nick4fake
  • Repository
  • 4 Watchers
  • 0 Stars
  • 1,415 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 43 Forks
  • 0 Open issues
  • 30 Versions
  • 0 % Grown

The README.md

Stream Component

Build Status, (*1)

Basic readable and writable stream interfaces that support piping., (*2)

In order to make the event loop easier to use, this component introduces the concept of streams. They are very similar to the streams found in PHP itself, but have an interface more suited for async I/O., (*3)

Mainly it provides interfaces for readable and writable streams, plus a file descriptor based implementation with an in-memory write buffer., (*4)

This component depends on événement, which is an implementation of the EventEmitter., (*5)

Readable Streams

EventEmitter Events

  • data: Emitted whenever data was read from the source.
  • end: Emitted when the source has reached the eof.
  • error: Emitted when an error occurs.
  • close: Emitted when the connection is closed.

Methods

  • isReadable(): Check if the stream is still in a state allowing it to be read from. It becomes unreadable when the connection ends, closes or an error occurs.
  • pause(): Remove the data source file descriptor from the event loop. This allows you to throttle incoming data.
  • resume(): Re-attach the data source after a pause().
  • pipe(WritableStreamInterface $dest, array $options = []): Pipe this readable stream into a writable stream. Automatically sends all incoming data to the destination. Automatically throttles based on what the destination can handle.

Writable Streams

EventEmitter Events

  • drain: Emitted if the write buffer became full previously and is now ready to accept more data.
  • error: Emitted whenever an error occurs.
  • close: Emitted whenever the connection is closed.
  • pipe: Emitted whenever a readable stream is pipe()d into this stream.

Methods

  • isWritable(): Check if the stream can still be written to. It cannot be written to after an error or when it is closed.
  • write($data): Write some data into the stream. If the stream cannot handle it, it should buffer the data or emit and error event. If the internal buffer is full after adding $data, write should return false, indicating that the caller should stop sending data until the buffer drains.
  • end($data = null): Optionally write some final data to the stream, empty the buffer, then close it.

Usage

    $loop = React\EventLoop\Factory::create();

    $source = new React\Stream\Stream(fopen('omg.txt', 'r'), $loop);
    $dest = new React\Stream\Stream(fopen('wtf.txt', 'w'), $loop);

    $source->pipe($dest);

    $loop->run();

The Versions

05/12 2016

dev-master

9999999-dev

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

The Development Requires

pipe stream

13/11 2016

dev-no-full-drain

dev-no-full-drain

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

The Development Requires

pipe stream

13/11 2016

dev-inject-buffer

dev-inject-buffer

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

The Development Requires

pipe stream

13/11 2016

dev-buffer-close

dev-buffer-close

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

The Development Requires

pipe stream

13/11 2016

dev-immediate-writes

dev-immediate-writes

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

The Development Requires

pipe stream

13/11 2016

dev-composite-close

dev-composite-close

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

The Development Requires

pipe stream

22/08 2016

v0.4.4

0.4.4.0

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

The Development Requires

pipe stream

16/08 2016

dev-fu-feof

dev-fu-feof

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

The Development Requires

pipe stream

14/08 2016

dev-close-buffer-once

dev-close-buffer-once

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

The Development Requires

pipe stream

14/08 2016

dev-no-bufferedsink

dev-no-bufferedsink

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

The Development Requires

pipe stream

06/07 2016

dev-nbio

dev-nbio

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

The Development Requires

pipe stream

08/06 2015

dev-no-end

dev-no-end

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

The Development Requires

pipe stream

09/06 2014

dev-changelog

dev-changelog

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

The Development Requires

pipe stream

30/03 2014

v0.4.1

0.4.1.0

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

pipe stream

16/02 2014

0.3.x-dev

0.3.9999999.9999999-dev

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

pipe stream

16/02 2014

v0.3.4

0.3.4.0

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

pipe stream

02/02 2014

v0.4.0

0.4.0.0

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

pipe stream

09/07 2013

v0.3.3

0.3.3.0

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

pipe stream

10/05 2013

v0.3.2

0.3.2.0

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

pipe stream

21/04 2013

v0.3.1

0.3.1.0

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

pipe stream

14/04 2013

v0.3.0

0.3.0.0

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

pipe stream

14/12 2012

v0.2.6

0.2.6.0

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

pipe stream

19/11 2012

v0.2.5

0.2.5.0

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

pipe stream

18/11 2012

v0.2.4

0.2.4.0

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

pipe stream

05/11 2012

v0.2.3

0.2.3.0

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

pipe stream

28/10 2012

v0.2.2

0.2.2.0

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

pipe stream

13/10 2012

v0.2.1

0.2.1.0

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

pipe stream

10/09 2012

v0.2.0

0.2.0.0

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

pipe stream

13/07 2012

v0.1.1

0.1.1.0

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

pipe stream

11/07 2012

v0.1.0

0.1.0.0

Basic readable and writable stream interfaces that support piping.

  Sources   Download

MIT

The Requires

 

pipe stream