Skip to content

Repository files navigation

PHPinnacle Buffer

Latest Version on PackagistSoftware LicenseTotal Downloads

PHPinnacle Buffer is a simple tool for operating binary data in PHP. Mostly it simply wraps PHP pack/unpack functions.

Install

Via Composer

$ composer require phpinnacle/buffer

Basic Usage

<?phpusePHPinnacle\Buffer\ByteBuffer;
// AMQP protocol header$buffer = newByteBuffer;
$buffer
->append('AMQP')
->appendUint8(0)
->appendUint8(0)
->appendUint8(9)
->appendUint8(1)
;

Testing

$ composer test

Benchmarks

$ composer bench

Some results with pure PHP realisation:

BenchmarkBest (μs)Mean (μs)Mode (μs)Worst (μs)
appendIntegers11.60512.11512.04712.888
appendFloats10.46410.91310.78617.943
appendString8.85741.02120.611362.174
consume48.91650.72150.39961.542
read26.61727.66527.50031.744

And results with enabled extension:

BenchmarkBest (μs)Mean (μs)Mode (μs)Worst (μs)
appendIntegers2.5222.6572.6253.031
appendFloats1.9872.1362.0953.307
appendString3.6923.8543.8065.695
consume13.70114.65414.45417.977
read5.1285.4255.3136.625

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email dev@phpinnacle.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Simple library for operating binary data in PHP

Topics

Resources

Contributing

Stars

24 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages