2017 © Pedro Peláez
 

library byte-buffer

A wrapper for the PHP pack() function. Simple handling of bytes in PHP (original by Ole 'nesQuick' Michaelis)

image

msst/byte-buffer

A wrapper for the PHP pack() function. Simple handling of bytes in PHP (original by Ole 'nesQuick' Michaelis)

  • Thursday, June 28, 2018
  • by corvinsteindl
  • Repository
  • 1 Watchers
  • 0 Stars
  • 213 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 9 Forks
  • 0 Open issues
  • 7 Versions
  • 25 % Grown

The README.md

PHP Library for reading and writing binary data

Build Status, (*1)

This is a improved rewrite of the Project from OleMchls You can also call this a pack() wrapper., (*2)

Additional Features

  • Autoincrement Offset
  • Write Int32, Int64, UInt64 and UTF8 Strings

Install

Installation should be done via composer., (*3)

composer require msst/byte-buffer

Or, (*4)

{
    "require": {
        "msst/byte-buffer": "dev-master"
    }
}

Example

A simple usage example could look like this, (*5)

<?php

require __DIR__ . '/vendor/autoload.php';

use MSST\ByteBuffer\Buffer;

$text1 = 'channel_one';
$text2 = "This is a utf8 test message. 😄";

$buffer = new Buffer(4 + 1 + 4 + strlen($text1) + strlen($text2));
$buffer->writeInt32($buffer->length());
$buffer->writeInt8(0x1);
$buffer->writeInt32(strlen($text1));
$buffer->write($text1);
$buffer->writeUtf8($text2);

$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
$result = socket_connect($socket, '127.0.0.1', 3542);

socket_write($socket, (string) $buffer, $buffer->length());

Testing

Just working under php > 7.1, (*6)

./vendor/bin/phpunit

License

Licensed under the MIT license., (*7)

Original Project: ByteBuffer by OleMchls, (*8)

The Versions

28/06 2018

dev-master

9999999-dev

A wrapper for the PHP pack() function. Simple handling of bytes in PHP (original by Ole 'nesQuick' Michaelis)

  Sources   Download

MIT

The Development Requires

library wrapper stream socket buffer pack bytehandling binary data

28/06 2018

v1.2

1.2.0.0

A wrapper for the PHP pack() function. Simple handling of bytes in PHP (original by Ole 'nesQuick' Michaelis)

  Sources   Download

MIT

The Development Requires

library wrapper stream socket buffer pack bytehandling binary data

28/06 2018

v1.1

1.1.0.0

A wrapper for the PHP pack() function. Simple handling of bytes in PHP (original by Ole 'nesQuick' Michaelis)

  Sources   Download

MIT

The Development Requires

library wrapper stream socket buffer pack bytehandling binary data

10/04 2018

v1.0

1.0.0.0

A wrapper for the PHP pack() function. Simple handling of bytes in PHP (original by Ole 'nesQuick' Michaelis)

  Sources   Download

MIT

The Development Requires

library wrapper stream socket buffer pack bytehandling binary data

09/04 2018

v0.4

0.4.0.0

Node.js inspired byte stream buffer for PHP. (Orginal by Ole 'nesQuick' Michaelis)

  Sources   Download

MIT

library wrapper stream socket buffer pack bytehandling binary data

13/01 2016

v0.3

0.3.0.0

Node.js inspired byte stream buffer for PHP.

  Sources   Download

MIT

library wrapper stream socket buffer pack bytehandling binary data

27/03 2012

v0.2

0.2.0.0

Node.js inspired byte stream buffer for PHP.

  Sources   Download

MIT

library wrapper stream socket buffer pack bytehandling binary data