PHPackages                             faj1/buffertools - 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. faj1/buffertools

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

faj1/buffertools
================

Toolbox for working with binary and hex data. Similar to NodeJS Buffer.

03PHP

Since Nov 13Pushed 1y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Buffertools
===========

[](#buffertools)

This library provides a `Buffer` and `Parser` class to make dealing with binary data in PHP easier. `Templates` extend this by offering a read/write interface for larger serialized structures.

[![Build Status](https://camo.githubusercontent.com/7a17d4219ba86b5b6ac9c1e9cb64fac8ba333598dfb4186914d2a6df44de63c7/68747470733a2f2f7472617669732d63692e6f72672f4269742d576173702f627566666572746f6f6c732d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Bit-Wasp/buffertools-php)[![Code Coverage](https://camo.githubusercontent.com/f5ba38d7fa3680268d58795d82002fd8993b8274b4371b008d38dc0474590641/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6269742d776173702f627566666572746f6f6c732d7068702f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/bit-wasp/buffertools-php/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/fbfc8005b87d2a2b7d6f8b1cfb839a06aab5400b82f18d089c980f69f472fef8/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4269742d576173702f627566666572746f6f6c732d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Bit-Wasp/buffertools-php/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/643ee11566a8d56329ad377cc702b7321afff226fc54d21df6994833de144ee7/68747470733a2f2f706f7365722e707567782e6f72672f626974776173702f627566666572746f6f6c732f762f737461626c65)](https://packagist.org/packages/bitwasp/buffertools)[![Total Downloads](https://camo.githubusercontent.com/56b2472df0fcfe0cb43f16e4176301a3334625c05b00fe44e8793a72df1402a5/68747470733a2f2f706f7365722e707567782e6f72672f626974776173702f627566666572746f6f6c732f646f776e6c6f616473)](https://packagist.org/packages/bitwasp/buffertools)[![License](https://camo.githubusercontent.com/ca9d79a08cb3c715be36c48bf3eff2ccb1b21edc7c7827690b6d57ee8cd06c53/68747470733a2f2f706f7365722e707567782e6f72672f626974776173702f627566666572746f6f6c732f6c6963656e7365)](https://packagist.org/packages/bitwasp/buffertools)

Requirements:
-------------

[](#requirements)

- PHP 7.0+
- Composer
- ext-gmp

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

[](#installation)

You can install this library via Composer: `composer require bitwasp/buffertools`

Examples
--------

[](#examples)

Buffer's are immutable classes to store binary data. Buffer::hex can be used to initialize from hex Buffer::int can be used to initialize from a positive decimal integer (int|string)

Buffer's main methods are:

- getBinary()
- getHex()
- getInt()

Parser will read Buffers. Parser's main methods are:

- readBytes()
- writeBytes()
- readArray()
- writeArray()

In most cases, the interface offered by Parser should not be used directly. Instead, Templates expose read/write access to larger serialized structures.

- [Example 1: Using buffer to wrap binary data](./examples/usingBuffer.php)
- [Example 2: Using parser to extract binary data](./examples/usingParser.php)
- [Example 3: Using templates to read multiple elements from a parser](./examples/usingTemplates.php)
- [Example 4: Using templates to read/write structured messages](./examples/usingTemplates2.php)

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance30

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity16

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/faj1-buffertools/health.svg)

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

###  Alternatives

[alom/graphviz

Graphviz generation for PHP

74651.4k9](/packages/alom-graphviz)[eclipxe/cfdiutils

PHP Common utilities for Mexican CFDI 3.2, 3.3 &amp; 4.0

141129.9k6](/packages/eclipxe-cfdiutils)[robertboes/inertia-breadcrumbs

Laravel package to automatically share breadcrumbs to Inertia

56129.1k](/packages/robertboes-inertia-breadcrumbs)[elhebert/laravel-sri

Subresource Integrity hash generator for laravel

40225.5k](/packages/elhebert-laravel-sri)[drupal-code-builder/drupal-code-builder

Code generator for Drupal

27241.1k1](/packages/drupal-code-builder-drupal-code-builder)[b13/bolt

Bolt - An easy TYPO3 integration basis

28202.9k2](/packages/b13-bolt)

PHPackages © 2026

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