s9e\Bencode is a simple Bencode library. It's probably the fastest and most efficient way to read bencoded strings on PHP 5.4 to PHP 5.6.