Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 18, 2024 via composer

amphp/byte-stream v2.1.0

A stream abstraction to make working with non-blocking I/O simple.
Package summary
Share
0
issues
1
license
7
MIT
Package created
24 Apr 2017
Version published
19 Nov 2023
Maintainers
3
Total deps
7
Direct deps
6
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
7 Packages, Including:
amphp/amp@v3.0.2
amphp/byte-stream@v2.1.0
amphp/parser@v1.1.1
amphp/pipeline@v1.2.0
amphp/serialization@v1.0.0
amphp/sync@v2.2.0
revolt/event-loop@v1.0.6
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

6
All Dependencies CSV
β“˜ This is a list of amphp/byte-stream 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
amphp/ampv3.0.2-MIT
prod
amphp/parserv1.1.1-MIT
prod
amphp/pipelinev1.2.0-MIT
prod
amphp/serializationv1.0.05.98 kBMIT
prod
amphp/syncv2.2.0-MIT
prod
revolt/event-loopv1.0.635.61 kBMIT
prod

Visualizations

Frequently Asked Questions

What does amphp/byte-stream do?

The amphp/byte-stream is an event-driven library designed with PHP concurrency and the fiber feature in mind, used for simplifying work with non-blocking I/O operations. The package specifically provides a stream abstraction, allowing an easy interface to work with multiple byte streams.

How do you use amphp/byte-stream?

The amphp/byte-stream can be utilized by installing it as a Composer dependency. After installation, the package offers two fundamental interfaces: ReadableStream and WritableStream which are abstractions over ordered sequences of bytes.

For example, if you want to use a ReadableStream, you can consume it as below:

$stream = ...;  // the stream to be consumed
$buffer = "";

while (($chunk = $stream->read()) !== null) {
    $buffer .= $chunk;
}

// use the $buffer variable for whatever you want

And when you want to use a WritableStream:

$readableStream = ...;  // the stream to be read from
$writableStream = ...;  // the stream to write to
$buffer = "";

while (($chunk = $readableStream->read()) !== null) {
    $writableStream->write($chunk);
}

$writableStream->end();

This package offers some basic implementations, and you can also find more in other libraries like amphp/socket.

Where are the amphp/byte-stream docs?

For detailed documentation and additional examples, users can refer to the readme content on the GitHub repository available at https://github.com/amphp/byte-stream.git. For specific examples on different implementations and usages, users can refer to the "./examples" directory present in the package's GitHub repository. It's also important to note that amphp/byte-stream follows the semver semantic versioning specification just like all other amphp packages.