2017 © Pedro Peláez
 

library bencode

Bencode serializer for PHP 5.3+

image

rych/bencode

Bencode serializer for PHP 5.3+

  • Wednesday, July 29, 2015
  • by rchouinard
  • Repository
  • 5 Watchers
  • 19 Stars
  • 9,099 Installations
  • PHP
  • 3 Dependents
  • 1 Suggesters
  • 6 Forks
  • 4 Open issues
  • 2 Versions
  • 7 % Grown

The README.md

Bencode serialization for PHP

Latest Version on Packagist ![Software License][ico-license] Build Status Quality Score ![Total Downloads][ico-downloads], (*1)

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., (*2)

Install

Via Composer, (*3)

``` bash $ composer require rych/bencode, (*4)



## Usage ### Encoding an array ```php <?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., (*5)

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:, (*6)

Array
(
    [array] => Array
        (
            [0] => one
            [1] => two
            [2] => three
        )

    [integer] => 42
    [string] => bar
)

Testing

bash $ vendor/bin/phpunit -c phpunit.dist.xml, (*7)

License

The MIT License (MIT). Please see License File for more information., (*8)

The Versions

29/07 2015

dev-master

9999999-dev https://github.com/rchouinard/bencode

Bencode serializer for PHP 5.3+

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

serialize bencode

13/01 2014

v1.0.0

1.0.0.0 https://github.com/rchouinard/bencode

Bencode serializer for PHP 5.3+

  Sources   Download

MIT

The Requires

  • php >=5.3.4

 

The Development Requires

serialize bencode