0
0
Fork 0
mirror of https://gitlab.com/sandfox/torrent-file.git synced 2026-04-21 06:32:34 +00:00
PHP Torrent File Class
Find a file
2025-10-28 23:44:34 +02:00
docs Examples from the spec 2025-07-10 14:45:41 +03:00
src Make exceptions final 2025-10-10 02:24:01 +03:00
tests PathNotFoundException -> ValueError 2025-10-10 02:23:42 +03:00
.gitattributes Update from templates 2025-06-29 00:03:06 +03:00
.gitignore Document changes 2023-11-10 10:27:06 +02:00
.gitlab-ci.yml Update style and test configs 2025-10-10 02:17:20 +03:00
.readthedocs.yaml Update from templates 2024-10-11 18:11:47 +03:00
CHANGELOG.md Changelog for 5.3.4 2025-10-28 23:44:34 +02:00
composer.json Allow Symfony 8 2025-10-28 23:39:57 +02:00
LICENSE.md init library 2017-03-22 23:22:46 +02:00
phpcs.xml Drop PHP 8.0, bencode 1.x, polyfills 2021-11-30 18:15:42 +02:00
phpunit.xml Update style and test configs 2025-10-10 02:17:20 +03:00
psalm.xml Update psalm 2023-07-14 18:10:21 +03:00
README.md Installation before examples 2024-07-28 13:38:41 +03:00

PHP Torrent File Library

Packagist PHP License Gitlab pipeline status Codecov

A PHP Class to work with torrent files

Installation

composer require arokettu/torrent-file

Usage

<?php

use Arokettu\Torrent\TorrentFile;

// open file
$torrent = TorrentFile::load('debian.torrent');
// create for path (file or directory)
$torrent = TorrentFile::fromPath('/home/user/dists/debian');

// manipulate fields
$torrent->setAnnounce('http://tracker.example:1234');

// list files
foreach ($torrent->v1()->getFiles() as $file) {
    echo implode('/', $file->path()) , ': ' , $file->length, PHP_EOL;
}

Features

  • Torrent file data manipulation
  • Torrent file creation
  • Torrent file listing
  • Support for torrent files version 1, version 2, Hybrid v1+v2, a lot of BEPs like Nodes, Url Lists, etc
  • Torrent file signing

CLI tool

A CLI tool based on the library: https://sandfox.dev/php/torrent-file-cli.html

Documentation

Read full documentation here: https://sandfox.dev/php/torrent-file.html

Also on Read the Docs: https://torrent-file.readthedocs.io/

Support

Please file issues on our main repo at GitLab: https://gitlab.com/sandfox/torrent-file/-/issues

Feel free to ask any questions in our room on Gitter: https://gitter.im/arokettu/community

Supported versions:

  • 5.x (current, PHP 8.1+)

License

The library is available as open source under the terms of the MIT License.