phuedx / tnetstring
PHP 的标签化 netstring 编码/解码器。
v2.0.1
2016-03-21 19:39 UTC
Requires
- php: >= 5.2.17
Requires (Dev)
- phpunit/phpunit: 4.1.*
This package is not auto-updated.
Last update: 2024-09-11 10:33:04 UTC
README
PHP 的标签化 netstring 编码器。
安装
推荐使用 Composer 安装 TNetstring。
composer.phar require phuedx/tnetstring
使用方法
<?php require_once __DIR__.'/vendor/autoload.php'; $payload = array( 'authors' => array( array( 'name' => 'Sam Smith', 'email' => 'yo@samsmith.io', 'homepage' => 'https://github.com/phuedx', ), ), ); $codec = new \Phuedx\TNetstring\Codec(); $encoded = $codec->encode($payload); $decoded = $codec->decode($encoded);
还有一个类似 JSON 的 API
$encoded = tnetstring_encode($payload); $decoded = tnetstring_decode($encoded);
资源
tnetstrings.org 曾经 包含了您需要了解标签化 netstring 所需的所有信息。
许可证
TNetstring 采用 MIT 许可证,版权所有 (c) 2011-2016 Sam Smith。有关完整的版权和许可证信息,请参阅 LICENSE。