devristo / torrent
BitTorrent 文件解码器/编码器
dev-master
2016-09-25 13:59 UTC
Requires (Dev)
- phpunit/phpunit: >=3
This package is auto-updated.
Last update: 2024-08-29 04:14:26 UTC
README
从 .torrent 文件中提取数据并修改它们
入门指南
使用 composer 安装。将以下内容添加到您的 composer.json 文件中
{ "repositories": [ { "type": "vcs", "url": "https://github.com/Devristo/torrent" } ], "require": { "devristo/torrent": "dev-master" } }
读取 Torrent 文件
use Devristo\Torrent\Torrent; $torrent = Torrent::fromFile('ubuntu-13.10-desktop-amd64.iso.torrent'); echo $torrent->getInfoHash(false) // echoes e3811b9539cacff680e418124272177c47477157
修改 Torrent 文件
$torrent->setPrivate(true); $torrent->setComment("Downloaded from example.org"); file_put_contents("private-tracker.torrent", $torrent->serialize());