1. Go to this page and download the library: Download imedge/protocol-netstring 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/ */
imedge / protocol-netstring example snippets
use Amp\ByteStream\ReadableBuffer;
use IMEdge\Protocol\NetString\NetStringReader;
$netString = new NetStringReader(new ReadableBuffer('5:Hello,6:world!,'));
foreach ($netString->packets() as $packet) {
var_dump($packet);
}
use Amp\ByteStream\WritableBuffer;
use IMEdge\Protocol\NetString\NetStringWriter;
$netString = new NetStringWriter($out = new WritableBuffer());
$netString->write('Hello');
$netString->write(' ');
$netString->write('World!');
$netString->close();
var_dump($out->buffer());
use Amp\ByteStream\ReadableBuffer;
use Amp\ByteStream\WritableBuffer;
use IMEdge\Protocol\NetString\NetStringConnection;
$netString = new NetStringConnection(new ReadableBuffer('5:Hello,6:world!,'), $out = new WritableBuffer());
$netString->write('Hi!');
foreach ($netString->packets() as $packet) {
var_dump($packet);
}
$out->close();
var_dump($out->buffer());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.