rych/bencode
最新稳定版本:v1.0.0
Composer 安装命令:
composer require rych/bencode
包简介
Bencode serializer for PHP 5.3+
关键字:
README 文档
README
This library allows developers to encode or decode bencoded data strings in PHP 5.3+. More information about bencode can be found at Wikipedia. The format is primarily used in the .torrent file specification.
Install
Via Composer
$ composer require rych/bencode
Usage
Encoding an array
<?php use Rych\Bencode\Bencode; $data = array( "string" => "bar", "integer" => 42, "array" => array( "one", "two", "three", ), ); echo Bencode::encode($data);
The above produces the string d5:arrayl3:one3:two5:threee7:integeri42e6:string3:bare.
Decoding a string
<?php use Rych\Bencode\Bencode; $string = "d5:arrayl3:one3:two5:threee7:integeri42e6:string3:bare"; print_r(Bencode::decode($string));
The above produces the the following output:
Array
(
[array] => Array
(
[0] => one
[1] => two
[2] => three
)
[integer] => 42
[string] => bar
)
Testing
$ vendor/bin/phpunit -c phpunit.dist.xml
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 21.6k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 31
- 点击次数: 1
- 依赖项目数: 3
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2012-08-22