Coder Social home page Coder Social logo

buffer's Introduction

PHPinnacle Buffer

Latest Version on Packagist Software License Coverage Status Total 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

<?php

use PHPinnacle\Buffer\ByteBuffer;

// AMQP protocol header
$buffer = new ByteBuffer;
$buffer
    ->append('AMQP')
    ->appendUint8(0)
    ->appendUint8(0)
    ->appendUint8(9)
    ->appendUint8(1)
;

Testing

$ composer test

Benchmarks

$ composer bench

Some 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:

Benchmark Best (μs) Mean (μs) Mode (μs) Worst (μs)
appendIntegers 2.522 2.657 2.625 3.031
appendFloats 1.987 2.136 2.095 3.307
appendString 3.692 3.854 3.806 5.695
consume 13.701 14.654 14.454 17.977
read 5.128 5.425 5.313 6.625

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.