No description
Find a file
2025-10-09 23:55:32 +03:00
docs Add codeberg 2025-06-11 11:54:41 +03:00
src Fix a PHP 8.5 notice 2025-10-09 23:48:56 +03:00
tests Add license declaration 2025-09-03 05:24:43 +03:00
.gitattributes Update from templates 2023-11-10 20:58:38 +02:00
.gitignore Document callback 2024-03-09 00:47:43 +02:00
.gitlab-ci.yml Test in all versions and on both architectures 2025-10-09 23:53:19 +03:00
.readthedocs.yaml Update from templates 2024-10-11 18:09:09 +03:00
CHANGELOG.md Changelog for 4.3.2 2025-10-09 23:55:32 +03:00
composer.json Update test and style configs 2025-10-09 23:47:56 +03:00
LICENSE.md start library 2017-03-22 10:12:30 +02:00
phpcs.xml Update test and style configs 2025-10-09 23:47:56 +03:00
phpunit.dist.xml Update test and style configs 2025-10-09 23:47:56 +03:00
psalm.xml Mark api 2023-07-14 18:07:10 +03:00
README.md Document BCMath support 2024-09-25 17:41:44 +03:00

PHP Bencode Encoder/Decoder

Packagist PHP Packagist Gitlab pipeline status Codecov

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:

  • 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 past major versions can be found on Read the Docs:

Support

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

License

The library is available as open source under the terms of the MIT License.