Bencode is the encoding used by the peer-to-peer file sharing system BitTorrent for storing and transmitting loosely structured data.
This is a pure PHP library that allows you to encode and decode Bencode data.
composer require 'arokettu/bencode'
Supported versions:
<?php
\Arokettu\Bencode\Bencode::encode(['info' => ['length' => 12345, 'name' => 'Bencoded demo']]);
\Arokettu\Bencode\Bencode::decode('d4:infod6:lengthi12345e4:name13:Bencoded demoee');
Read full documentation here: https://sandfox.dev/php/bencode.html
Documentation for all past major versions can be found on Read the Docs:
Please file issues on our main repo at GitLab: https://gitlab.com/sandfox/bencode/-/issues
Feel free to ask any questions in our room on Gitter: https://gitter.im/arokettu/community
The library is available as open source under the terms of the MIT License.