定制 vohof/transmission 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

vohof/transmission

Composer 安装命令:

composer require vohof/transmission

包简介

Awesome PHP JSON-RPC client library for Transmission

README 文档

README

A fully-tested PHP JSON-RPC client library for Transmission

Build Status

Table of Contents

Installation

Install through Composer:

{
  "require": {
    "vohof/transmission": "1.0.*"
  }
}

Example Usage

$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();

See the tests for more usage

Use Transmission with Laravel

Add the service provider and alias the package in config/app.php

'providers' => array(
    ...
    'Vohof\TransmissionServiceProvider'
),
'aliases' => array(
    ...
    'Transmission' => 'Vohof\TransmissionFacade'
)

Publish config and modify app/config/packages/transmission/config.php

$ php artisan config:publish transmission --path=vendor/vohof/transmission/src/config

Use the library:

Transmission::add($base64EncodedTorrent, true);
Torrent::stats();

Advanced

The library uses Guzzle as it's HTTP Client but you can choose to swap it with something else if you want (eg. Buzz)

class BuzzClient extends \Vohof\ClientAbstract {
    ...
}

$transmission = new Vohof\Transmission($config, new BuzzClient);

To-Do

  • torrent-rename-path, blocklist-update

License

See LICENSE

统计信息

  • 总下载量: 1.71k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 18
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 18
  • Watchers: 4
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2013-07-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固