PHPackages                             podoko/bencode - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. podoko/bencode

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

podoko/bencode
==============

library to read and write files using the bencode format

0.1.0(4mo ago)01MITPHPPHP ^8.4

Since Feb 10Pushed 4mo agoCompare

[ Source](https://github.com/podoko/php-bencode)[ Packagist](https://packagist.org/packages/podoko/bencode)[ RSS](/packages/podoko-bencode/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (2)Used By (0)

PHP Encode/Decode Library
=========================

[](#php-encodedecode-library)

A lightweight PHP library for encoding and decoding data in a simple, consistent way.## What is Bencode?

What is Bencode?
----------------

[](#what-is-bencode)

**Bencode** is a data serialization format originally developed for the BitTorrent protocol. It supports integers, byte strings, lists, and dictionaries in a compact and deterministic format.

Learn more:

Requirements
------------

[](#requirements)

- PHP &gt;= 8.4

Installation
------------

[](#installation)

### Via Composer

[](#via-composer)

```
composer require podoko/php-bencode
```

Usage
-----

[](#usage)

### Encoding

[](#encoding)

```
use Podoko\Bencode\Encoder;

$encoder = new Encoder();
$encoded = $encoder->encode('Hello World!'); // d12:Hello World!
```

### Decoding

[](#decoding)

```
use Podoko\Bencode\Decoder;

$decoder = new Decoder();
$decoded = $decoder->decode('d12:Hello World!'); // "Hello World!"
```

The decoder is intentionally **lenient**. It accepts data that is not strictly valid bencode, including:

- Unsorted dictionary keys
- Integers with leading zeros

This makes it suitable for parsing non-compliant or loosely formatted bencoded data

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance74

Regular maintenance activity

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

143d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/17113141?v=4)[podoko](/maintainers/podoko)[@podoko](https://github.com/podoko)

---

Top Contributors

[![podoko](https://avatars.githubusercontent.com/u/17113141?v=4)](https://github.com/podoko "podoko (8 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/podoko-bencode/health.svg)

```
[![Health](https://phpackages.com/badges/podoko-bencode/health.svg)](https://phpackages.com/packages/podoko-bencode)
```

###  Alternatives

[dillingham/nova-detail-link

A Laravel Nova field.

22123.1k2](/packages/dillingham-nova-detail-link)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
