devristo/torrent

Torrent file decoder / encoder

Installs: 2 381

Dependents: 0

Suggesters: 0

Security: 0

Stars: 36

Watchers: 4

Forks: 11

Open Issues: 0

pkg:composer/devristo/torrent

dev-master 2016-09-25 13:59 UTC

This package is auto-updated.

Last update: 2025-09-29 02:05:37 UTC


README

Extract data from .torrent files and change them

Getting started

Install using composer. Add the following to your composer.json

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/Devristo/torrent"
        }
    ],
    "require": {
        "devristo/torrent": "dev-master"
    }
}

Reading Torrent Files

use Devristo\Torrent\Torrent;

$torrent = Torrent::fromFile('ubuntu-13.10-desktop-amd64.iso.torrent');
echo $torrent->getInfoHash(false) // echoes e3811b9539cacff680e418124272177c47477157

Modifying Torrent Files

$torrent->setPrivate(true);
$torrent->setComment("Downloaded from example.org");

file_put_contents("private-tracker.torrent", $torrent->serialize());