PHPackages                             eouna/pack-binary - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. eouna/pack-binary

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

eouna/pack-binary
=================

use to read or write binary files

v1.0.6(6y ago)541MITPHPPHP &gt;=7.0

Since Aug 23Pushed 5y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (8)Used By (0)

### PHP Read And Write Binary Stream Package

[](#php-read-and-write-binary-stream-package)

Binary Stream Packager - a tools to handle binary data or stream

- #### [中文版](https://github.com/eouna/pack-binary/blob/master/README_CN.md)

    [](#中文版)
- #### Manual

    [](#manual)

    - ##### Write Stream Method

        [](#write-stream-method)

        ```
        use BinaryStream\BinaryWriter;
        $writer = new BinaryWriter();
        $writer->writeUTFString( str_repeat("It`s long string,", 200) );
        $writer->writeUTFString("");
        $writer->writeInt32(-90);
        $writer->writeDouble(800);
        $writer->writeFloat(3.88511321334343434324443324321);
        $writer->writeDouble(148.3243413243132134343213244313132);
        $writer->writeChar("s");
        $byteWriter = new ByteWriter();
        $byteWriter->writeByte(120);
        $byteWriter->writeInt16ToByte(65530);
        $byteWriter->writeInt32ToByte(1526456146);
        $writer->writeByteObject($byteWriter);
        ```
    - **note**

        1. the default encode method is BIG ENDIAN you can use method ****setBinaryModel**** to change it

        ```
         $write->setBinaryModel(BinaryCode::LITTLE_ENDIAN | BinaryCode::BIG_ENDIAN);
        ```

        2. the default write flag to store file is ***FILE\_BINARY*** you can use method ****store**** to change it

        ```
           $writer->store(FILE_APPEND);
          //or
          $writer->store(FILE_TEXT);
          //or
          $writer->store(FILE_APPEND | LOCK_EX);
        ```
    - ##### Read Stream Method

        [](#read-stream-method)

        ###### the read sequence must match with the write sequence

        [](#the-read-sequence-must-match-with-the-write-sequence)

        ```
        $reader = new BinaryReader($writer->getWriteStream());
        $res[] = $reader->readUTFString();
        $res[] = $reader->readUTFString();
        $res[] = $reader->readInt32();
        $res[] = $reader- >readDouble();
        $res[] = $reader->readDouble();
        $res[] = $reader->readFloat();
        $res[] = $reader->readDouble();
        $res[] =  $reader->readChar();
        $byteReader = $reader->readByByteReader();
        $res[] = $byteReader->readByte();
        $res[] = $byteReader->readBytesToShort();
        $res[] = $byteReader->readByteToInt32();

        ```
- #### How To Use It

    [](#how-to-use-it)

> use
>
> ***composer require eouna/pack-binary***
>
>  to install this package

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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 ~35 days

Recently: every ~51 days

Total

7

Last Release

2246d ago

PHP version history (2 changes)v1.0.0PHP &gt;=5.3

v1.0.3PHP &gt;=7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/66abbb094f1a59ff810952a9168e165839a061aa9bbddeb83f5c92dea9419a6b?d=identicon)[5\_coin\_valley\_master](/maintainers/5_coin_valley_master)

---

Top Contributors

[![eouna](https://avatars.githubusercontent.com/u/54256285?v=4)](https://github.com/eouna "eouna (12 commits)")

---

Tags

binarybinary-bufferbinary-streamdatastreamstreambinary

### Embed Badge

![Health badge](/badges/eouna-pack-binary/health.svg)

```
[![Health](https://phpackages.com/badges/eouna-pack-binary/health.svg)](https://phpackages.com/packages/eouna-pack-binary)
```

###  Alternatives

[alchemy/binary-driver

A set of tools to build binary drivers

19110.9M39](/packages/alchemy-binary-driver)[comcast/php-legal-licenses

A utility to generate a Licenses file containing the full license text for every dependency in your project for legal purposes.

821.1M9](/packages/comcast-php-legal-licenses)[wapmorgan/binary-stream

A handy tool for working with binary data

52263.1k6](/packages/wapmorgan-binary-stream)[ademarre/binary-to-text-php

Collection of binary-to-text encoding utilities for PHP. Includes Base32 support and much more.

40165.8k](/packages/ademarre-binary-to-text-php)[phar-io/composer-distributor

Base Code for a composer plugin that installs PHAR-files

13581.1k6](/packages/phar-io-composer-distributor)[yaroslavche/bitmask

BitMask, EnumBitMask

3453.7k1](/packages/yaroslavche-bitmask)

PHPackages © 2026

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