PHPackages                             dsmithhayes/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. dsmithhayes/bencode

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

dsmithhayes/bencode
===================

A simple bencoding library for PHP.

v0.1.3(10y ago)349BSD 3.0PHP

Since Sep 7Pushed 10y ago1 watchersCompare

[ Source](https://github.com/dsmithhayes/bencode)[ Packagist](https://packagist.org/packages/dsmithhayes/bencode)[ Docs](https://github.com/dsmithhayes/bencode)[ RSS](/packages/dsmithhayes-bencode/feed)WikiDiscussions master Synced yesterday

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

Bencode
=======

[](#bencode)

This is a library used for encoding and decoding bencoded streams. Bencoding is primarily found in the makeup of `.torrent` files.

Bencoding Basics
----------------

[](#bencoding-basics)

Pronounced bee-encoding, this encoding focuses on binary encoding with four basic element data structures.

1. `Integer`
2. `Byte`
3. `List`
4. `Dictionary`

The last two elements (`List`, `Dictionary`) are just collections of the first two elements.

### Integer

[](#integer)

The Integer element is a positive or negative integer that is always prefixed with an `i`, and suffixed with an `e`.

```
i45e
i-1e

```

#### Usage

[](#usage)

```
