bitwasp/buffertools

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

Package info

github.com/Bit-Wasp/buffertools-php

pkg:composer/bitwasp/buffertools

Statistics

Installs: 778 758

Dependents: 47

Suggesters: 0

Stars: 64

Open Issues: 7

v0.5.7 2020-01-17 21:31 UTC

Requires

  • php-64bit: >=7.0.0

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 133746d0b514e0016d8479b54aa97475405a9f1f


README

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
👁 Code Coverage
👁 Scrutinizer Code Quality
👁 Latest Stable Version
👁 Total Downloads
👁 License

Requirements:

  • PHP 7.0+
  • Composer
  • ext-gmp

Installation

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

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.