A tagged netstring encoder/decoder for PHP.
A tagged netstring codec for PHP.
The recommended way to install TNetstring is with Composer.
composer.phar require phuedx/tnetstring
<?php require_once __DIR__.'/vendor/autoload.php'; $payload = array( 'authors' => array( array( 'name' => 'Sam Smith', 'email' => 'firstname.lastname@example.org', 'homepage' => 'https://github.com/phuedx', ), ), ); $codec = new \Phuedx\TNetstring\Codec(); $encoded = $codec->encode($payload); $decoded = $codec->decode($encoded);
There's also a JSON-like API:
$encoded = tnetstring_encode($payload); $decoded = tnetstring_decode($encoded);
tnetstrings.org had all of the information you'll need to get acquainted with tagged netstrings.
TNetstring is licensed under the MIT license and is copyright (c) 2011-2016 Sam Smith. See LICENSE for full copyright and license information.