1. Go to this page and download the library: Download eouna/pack-binary library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
eouna / pack-binary example snippets
use BinaryStream\BinaryWriter;
$writer = new BinaryWriter();
$writer->writeUTFString( str_repeat("It`s long string,", 200) );
$writer->writeUTFString("");
$writer->writeInt32(-90);
$writer->writeDouble(800);
$writer->writeFloat(3.88511321334343434324443324321);
$writer->writeDouble(148.3243413243132134343213244313132);
$writer->writeChar("s");
$byteWriter = new ByteWriter();
$byteWriter->writeByte(120);
$byteWriter->writeInt16ToByte(65530);
$byteWriter->writeInt32ToByte(1526456146);
$writer->writeByteObject($byteWriter);