PHPackages                             nrk/bencoder - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. nrk/bencoder

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

nrk/bencoder
============

A Bencode serializer and deserializer in pure PHP

v1.0.0(14y ago)55731MITPHPPHP &gt;=5.3.0

Since Dec 24Pushed 14y ago1 watchersCompare

[ Source](https://github.com/nrk/bencoder)[ Packagist](https://packagist.org/packages/nrk/bencoder)[ Docs](http://github.com/nrk/bencoder)[ RSS](/packages/nrk-bencoder/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (2)Used By (0)

Bencoder
========

[](#bencoder)

### About

[](#about)

**Bencoder** is an utility class implemented in pure PHP that handles the serialization and deserialization of objects using the [Bencode](http://en.wikipedia.org/wiki/Bencode) encoding format.

The original implementation of this class dates back to the early months of 2004 and it has been somewhat adapted and updated in order to work with modern versions of the PHP interpreter right before making it public. Basically I am making this library open source just because someone might find it useful and it would be a shame to let it rot in the meanders of my backups.

### Implementation details

[](#implementation-details)

- As per specifications, this class does not handle float / double values.
- The serialization and deserialization of integers greater than *2147483647* works only when using a 64bit PHP interpreter.
- PHP arrays containing one or more string values as keys are interpreted as Bencode dictionaries.
- The serializer does not check for circular references and it breaks generating a stack overflow error.

### Example

[](#example)

```
