vohof / transmission
此包最新版本(v1.0.3)没有可用的许可信息。
Transmission 的出色 PHP JSON-RPC 客户端库
v1.0.3
2013-08-01 21:59 UTC
Requires
- php: >=5.3.0
- guzzle/guzzle: 3.7.1
Requires (Dev)
- mockery/mockery: 0.8.*
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2024-09-23 14:13:08 UTC
README
为 Transmission 提供的经过充分测试的 PHP JSON-RPC 客户端库
目录
安装
通过 Composer 安装
{
"require": {
"vohof/transmission": "1.0.*"
}
}
示例使用
$config = array( 'host' => 'http://127.0.0.1', 'endpoint' => '/transmission/rpc', 'username' => 'foo', // Optional 'password' => 'bar' // Optional ); $transmission = new Vohof\Transmission($config); // Add a torrent $torrent = $transmission->add('magnet:?xt=urn:btih:335990d615594b9be409ccfeb95864e24ec702c7&dn=Ubuntu+12.10+Quantal+Quetzal+%2832+bits%29&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ftracker.istole.it%3A6969&tr=udp%3A%2F%2Ftracker.ccc.de%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337'); // or $content = base64_encode(file_get_contents('MyTorrent.torrent')); $torrent = $transmission->add($content, true); // Stop a torrent $transmission->action('stop', $torrent['id']); // Limit download speed $transmission->set($torrent['id'], array('downloadLimit' => 100)); // Get torrent size $transmission->get($torrent['id'], array('totalSize')); // Remove torrent $transmission->remove($torrent['id']);); // Remove torrent and its files $transmission->remove($torrent['id'], true); // Stats $transmission->getStats();
查看测试以获取更多使用方法
在 Laravel 中使用 Transmission
在 config/app.php 中添加服务提供者并将包别名化
'providers' => array( ... 'Vohof\TransmissionServiceProvider' ), 'aliases' => array( ... 'Transmission' => 'Vohof\TransmissionFacade' )
发布配置并修改 app/config/packages/transmission/config.php
$ php artisan config:publish transmission --path=vendor/vohof/transmission/src/config
使用库
Transmission::add($base64EncodedTorrent, true); Torrent::stats();
高级
该库使用 Guzzle 作为其 HTTP 客户端,但您可以选择将其与其他内容交换(例如,Buzz)
class BuzzClient extends \Vohof\ClientAbstract { ... } $transmission = new Vohof\Transmission($config, new BuzzClient);
待办事项
- torrent-rename-path, blocklist-update
许可
查看 LICENSE