Skip to content

jesseschalken/pure-bencode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pure-bencode

A simple, efficient and complete Bencode encoder/decoder for PHP.

Installation

Install the composer package.

Usage

use \PureBencode\Bencode;

// encode
$bencode = Bencode::encode($value);

// decode
$value   = Bencode::decode($bencode);
  • Bencode::encode() accepts only PHP values which can be converted to their exact original by Bencode::decode(). Those are ints, strings and arrays whose contents are also valid.
  • arrays with keys of the form 0, 1, 2...n with be encoded as lists. All others will be encoded as dictionaries with their keys in sorted order.
  • Any problems will result in a \PureBencode\Exception with an appropriate message.

That is all. Have fun Bencodeing!

About

A simple, efficient and complete Bencode encoder/decoder for PHP

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages