arokettu / bencode
BitTorrent's Bencode encoder/decoder
4.1.0
2023-07-14 17:01 UTC
Requires
- php: ^8.1
- arokettu/is-resource: ^1.0
Requires (Dev)
- ext-gmp: *
- ext-json: *
- brick/math: *
- mikey179/vfsstream: ^1.6.10@alpha
- pear/math_biginteger: ^1.0
- phpunit/phpunit: ^9.4
- psy/psysh: *
- sandfox.dev/code-standard: ^1
- squizlabs/php_codesniffer: *
- symfony/phpunit-bridge: ^6.1
- vimeo/psalm: ^5.2
Suggests
- php-64bit: Running 64 bit is recommended to prevent integer overflow
- ext-gmp: In case you need integers larger than your architecture supports
- brick/math: In case you need integers larger than your architecture supports
- pear/math_biginteger: In case you need integers larger than your architecture supports
This package is auto-updated.
Last update: 2023-09-18 18:36:05 UTC
README
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.
Installation
composer require 'arokettu/bencode'
Supported versions:
- 1.x (bugfixes only, PHP 7.0+)
- 2.x (bugfixes only, PHP 8.0+)
- 3.x (bugfixes only, PHP 8.1+)
- 4.x (current, PHP 8.1+)
Simple use
<?php \Arokettu\Bencode\Bencode::encode(['info' => ['length' => 12345, 'name' => 'Bencoded demo']]); \Arokettu\Bencode\Bencode::decode('d4:infod6:lengthi12345e4:name13:Bencoded demoee');
Documentation
Read full documentation here: https://sandfox.dev/php/bencode.html
Documentation for all supported versions can be found on Read the Docs:
- 1.x: https://bencode.readthedocs.io/en/1.x/
- 2.x: https://bencode.readthedocs.io/en/2.x/
- 3.x: https://bencode.readthedocs.io/en/3.x/
- 4.x: https://bencode.readthedocs.io/
Support
Please file issues on our main repo at GitLab: https://gitlab.com/sandfox/bencode/-/issues
License
The library is available as open source under the terms of the MIT License.