PHPackages                             typiqally/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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. typiqally/binary

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

typiqally/binary
================

PHP Binary Serializer

1.0-alpha1(5y ago)00GPL-3.0-or-laterPHPPHP ^7.4 || ^8.0

Since Dec 14Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Typiqally/binary)[ Packagist](https://packagist.org/packages/typiqally/binary)[ Docs](https://github.com/Typiqally/binary)[ RSS](/packages/typiqally-binary/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

PHP Binary Serializer
=====================

[](#php-binary-serializer)

This package aims to help create structured models for binary data. For example, this can be used to provide a structured way to (de)serialize incoming and outgoing TCP data or other for other binary related use-cases.

Note
----

[](#note)

This project is currently under development and still in an alpha stage.

Installation
------------

[](#installation)

The package can be installed by executing the following command:

```
composer require typiqally/binary

```

Model
-----

[](#model)

Structured binary models are created like this:

```
use Typiqally\Binary\BinaryModel;

class Packet extends BinaryModel
{
    public array $fields = [
        //Name => [Type, Expected length],
        'magic' => ['raw', 4],
        'protocol' => ['numeric', 1],
        'length' => ['numeric', 2],
    ];
}
```

### Usage

[](#usage)

When the model is created, serializing is very easy. The constructor is automatically created and can be inherited if required. Just construct your model like this:

```
$model = new Packet("\x12\x34\x56\x78", 10, 1337);
```

#### Serialization

[](#serialization)

To serialize your model to binary, simply call the following function:

```
$value = BinarySerializer::serialize($model);
//Output (converted to hex using bin2hex): 123456780a0539
```

#### Deserialization

[](#deserialization)

To deserialize your binary to a model, you can call the following function:

```
$model = BinarySerializer::deserialize(Packet::class, $value);
//Output (by using the internal __toString function): magic=%124Vx, protocol=10, length=1337
```

License
-------

[](#license)

This project is licensed under the GPL-3.0 license. See [LICENSE.md](https://github.com/Typiqally/binary/blob/master/LICENSE.md) for the full license text.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

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

Unknown

Total

1

Last Release

1981d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/22e14f0405d24e225a2117e0d079f1c812b2d2c5aa6839af8bd0b37cf7dc4ff0?d=identicon)[Typically](/maintainers/Typically)

---

Top Contributors

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

---

Tags

deserializeserializationserializerserializationdeserializationbinarydeserializerpackettypiqally

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[jms/serializer

Library for (de-)serializing data of any complexity; supports XML, and JSON.

2.3k135.8M851](/packages/jms-serializer)[jms/serializer-bundle

Allows you to easily serialize, and deserialize data of any complexity

1.8k89.3M627](/packages/jms-serializer-bundle)[flix-tech/avro-serde-php

A library to serialize and deserialize Avro records making use of the confluent schema registry

674.0M17](/packages/flix-tech-avro-serde-php)

PHPackages © 2026

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