定制 ohffs/transmission-client 二次开发

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

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

ohffs/transmission-client

Composer 安装命令:

composer require ohffs/transmission-client

包简介

PHP library for the Transmission BitTorrent client

README 文档

README

WIP

Basic PHP API wrapper for Transmission

This is a (for now) very basic wrapper around the Transmission bittorrent client's API.

For now it only supports getting a list of all current torrents, fetching a specific torrent and adding a new torrent. This was all I needed for my purposes in transcopy.

If you are a Laravel user, you might want to check out the Laravel Wrapper.

Installing

Assuming you have composer available :

composer require ohnotnow/transmission-client

Usage

$client = new \Ohffs\Transmission\Client('127.0.0.1', 9091, 'username', 'password');

$allTorrents = $client->all(); // returns an array of TorrentEntry's

$singleTorrent = $client->find(1234); // returns a single TorrentEntry or null

$borkedTorrent = $client->find(-1); // returns null

$ohno = $client->findOrFail(-1); // throws a RuntimeException

$newTorrent = $client->add('/path/to/an/exciting.torrent'); // returns a TorrentEntry

$pausedTorrent = $client->addPaused('/path/to/an/exciting.torrent'); // returns a TorrentEntry and pauses it in transmission

$client->remove(1234); // removes a torrent from transmission - returns a boolean

The TorrentEntry is a small class which wraps the data that comes back from Transmission :

$singleTorrent = $client->find(1234);
var_dump($singleTorrent->toArray());
/*
 'name' => 'Some Exciting File',
 'id' => 1234,
 'doneDate' => 0,
 'eta' => 1000,
 'haveValid' => 0,
 'rateDownload' => 0,
 'rateUpload' => 0,
 'status' => 2,
 'totalSize' => 364514248,
 'downloadDir' => '/tmp/torrents',
 'percentDone' => 0.3,
*/

// And you can also get those as attributes on the object, eg :

echo $torrent->name;
// 'Some Exciting File'

Instead of passing the host, username etc when creating a client, you can set some environment variables which will be used :

TRANSMISSION_HOST=127.0.0.1
TRANSMISSION_PORT=9091
TRANSMISSION_USERNAME=whatever
TRANSMISSION_PASSWORD=secret

ohffs/transmission-client 适用场景与选型建议

ohffs/transmission-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 195 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 03 月 07 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 ohffs/transmission-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ohffs/transmission-client 我们能提供哪些服务?
定制开发 / 二次开发

基于 ohffs/transmission-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-03-07