PHPackages                             ekstazi/async-binary-stream - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. ekstazi/async-binary-stream

ActiveLibrary[Queues &amp; Workers](/categories/queues)

ekstazi/async-binary-stream
===========================

Set of amphp streams to work with binary data. It can read bytebuffer with specified length and write it.

1.1(6y ago)03MITPHPPHP &gt;=7.2CI failing

Since Apr 6Pushed 6y ago1 watchersCompare

[ Source](https://github.com/Ekstazi/async-binary-stream)[ Packagist](https://packagist.org/packages/ekstazi/async-binary-stream)[ RSS](/packages/ekstazi-async-binary-stream/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (5)Versions (3)Used By (0)

async-binary-stream
===================

[](#async-binary-stream)

Set of amphp streams to work with binary data. It can read [ByteBuffer](https://github.com/phpinnacle/buffer) with specified length and write it.

Installation
============

[](#installation)

This package can be installed as a Composer dependency.

`composer require ekstazi/async-binary-stream`

Requirements
============

[](#requirements)

PHP 7.2+

Usage
=====

[](#usage)

For reading and parsing data
----------------------------

[](#for-reading-and-parsing-data)

```
use \ekstazi\stream\binary\ByteReader;
use \Amp\ByteStream\InputStream;
use \PHPinnacle\Buffer\ByteBuffer;

/** @var InputStream $inputStream */
$reader = new ByteReader($inputStream);
/** @var ByteBuffer $buffer */
$buffer = yield $reader->readBytes(4);

$opCode = $buffer->consumeInt16();
$mask = $buffer->consumeInt16();
```

For writing data
----------------

[](#for-writing-data)

```
use \ekstazi\stream\binary\ByteWriter;
use \Amp\ByteStream\OutputStream;
use \PHPinnacle\Buffer\ByteBuffer;

$opCode = 2;
$mask = 1;

/** @var OutputStream $outputStream */
$writer = new ByteWriter($outputStream);

/** @var ByteBuffer $buffer */
$buffer = new ByteBuffer();
$buffer->appendInt16($opCode);
$buffer->appendInt16($mask);

yield $writer->writeBytes($buffer);
```

For recording read data
-----------------------

[](#for-recording-read-data)

```
use \ekstazi\stream\binary\ByteReader;
use \ekstazi\stream\binary\ByteRecorder;

use \Amp\ByteStream\InputStream;
use \PHPinnacle\Buffer\ByteBuffer;

/** @var InputStream $inputStream */
$reader = new ByteReader($inputStream);
$recorder = new ByteRecorder($reader);

$recorder->startRecord();
/** @var ByteBuffer $buffer */
$buffer = yield $recorder->readBytes(4);

$opCode = $buffer->consumeInt16();
$mask = $buffer->consumeInt16();
// ....
$buffer = yield $recorder->readBytes(12);
// ....

/** @var ByteBuffer $recorded  The data recorded after startRecord */
$recorded = $recorder->stopRecord();
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~4 days

Total

2

Last Release

2224d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a08d5fa71cb89d140c2e3493261de61b2c215a13eef0e21f21727a38f7a10361?d=identicon)[Ekstazi](/maintainers/Ekstazi)

---

Top Contributors

[![Ekstazi](https://avatars.githubusercontent.com/u/992738?v=4)](https://github.com/Ekstazi "Ekstazi (6 commits)")

---

Tags

streamasyncnon-blockingampamphpbinarybyte buffer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ekstazi-async-binary-stream/health.svg)

```
[![Health](https://phpackages.com/badges/ekstazi-async-binary-stream/health.svg)](https://phpackages.com/packages/ekstazi-async-binary-stream)
```

###  Alternatives

[amphp/byte-stream

A stream abstraction to make working with non-blocking I/O simple.

392116.2M104](/packages/amphp-byte-stream)[amphp/socket

Non-blocking socket connection / server implementations based on Amp and Revolt.

26439.0M119](/packages/amphp-socket)[amphp/file

Non-blocking access to the filesystem based on Amp and Revolt.

1103.3M94](/packages/amphp-file)[amphp/dns

Async DNS resolution for Amp.

19239.2M41](/packages/amphp-dns)[amphp/pipeline

Asynchronous iterators and operators.

7432.7M34](/packages/amphp-pipeline)[amphp/http-server

A non-blocking HTTP application server for PHP based on Amp.

1.3k4.5M81](/packages/amphp-http-server)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
