PHPinnacle Buffer is a simple tool for operating binary data in PHP. Mostly it simply wraps PHP pack/unpack functions.
Via Composer
$ composer require phpinnacle/buffer<?php
use PHPinnacle\Buffer\ByteBuffer;
// AMQP protocol header
$buffer = new ByteBuffer;
$buffer
->append('AMQP')
->appendUint8(0)
->appendUint8(0)
->appendUint8(9)
->appendUint8(1)
;$ composer test$ composer benchSome results with pure PHP realisation:
| Benchmark | Best (μs) | Mean (μs) | Mode (μs) | Worst (μs) |
|---|---|---|---|---|
| appendIntegers | 11.605 | 12.115 | 12.047 | 12.888 |
| appendFloats | 10.464 | 10.913 | 10.786 | 17.943 |
| appendString | 8.857 | 41.021 | 20.611 | 362.174 |
| consume | 48.916 | 50.721 | 50.399 | 61.542 |
| read | 26.617 | 27.665 | 27.500 | 31.744 |
And results with enabled extension:
Please see CONTRIBUTING and CONDUCT for details.
If you discover any security related issues, please email dev@phpinnacle.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
