bhutanio/bencode is a Laravel package for bencode serializer for laravel.
It currently has 9 GitHub stars and 901 downloads on Packagist (latest version v2.0.3).
Install it with composer require bhutanio/bencode.
Discover more Laravel packages by bhutanio
or browse all Laravel packages to compare alternatives.
Last updated
This library allows developers to encode or decode bencoded data strings in Laravel. More information about bencode can be found at Wikipedia. The format is primarily used in the .torrent file specification.
Via Composer
$ composer require bhutanio/bencode
<?php
use Bhutanio\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.
<?php
use Bhutanio\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
)
$ composer install
$ vendor/bin/phpunit
The MIT License (MIT). Please see License File for more information.