ktorfs/transmission-rpc

PHP 100% object-oriented Transmission RPC client. This library gives you code-completion for all requests and responses available from the Transmission daemon.

1.0.2 2015-04-24 12:25 UTC

This package is auto-updated.

Last update: 2024-04-07 01:20:21 UTC


README

A 100% OOP RPC client for Transmission. This library gives you code-completion for all requests and responses available from the Transmission daemon.

The plan is to keep this in sync at all times with Transmission RPC specs. Should you notice I'm behind on the specs, please notify me by opening a new issue.

Installation

Installation is done through composer.

Usage example

use \Transmission\Transmission;
use \Transmission\Requests;
use \Transmission\Responses;

try {
    $tr = new Transmission();
    $request = new Requests\TorrentGet();
    $request->fields = array(Requests\TorrentGet::eta, Requests\TorrentGet::name, Requests\TorrentGet::percentDone);
    #$request->includeAll();
    $response = $tr->torrentGet($request);
    foreach($response->torrents as $torrent) {
        printf('%s: %d%% done, %d seconds left<br>', $torrent->name, $torrent->percentDone * 100, $torrent->eta);
    }
} catch (Exception $e) {
    printf('Error %d - %s', $e->getCode(), $e->getMessage());
}