PHPackages                             fatkulnurk/torrent - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. fatkulnurk/torrent

ActiveLibrary[API Development](/categories/api)

fatkulnurk/torrent
==================

A unified, type-safe PHP SDK for interacting with various torrent clients (qBittorrent, Transmission, rTorrent, Deluge, rqbit, aria2) via HTTP/JSON APIs.

v1.0.0(3w ago)00MITPHPPHP ^8.3CI passing

Since May 16Pushed 3w agoCompare

[ Source](https://github.com/fatkulnurk/torrent)[ Packagist](https://packagist.org/packages/fatkulnurk/torrent)[ Docs](https://github.com/fatkulnurk/torrent)[ RSS](/packages/fatkulnurk-torrent/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

fatkulnurk/torrent
==================

[](#fatkulnurktorrent)

**PHP torrent client SDK** — manage qBittorrent, Transmission, rTorrent, Deluge, rqbit, and aria2 through a single unified API. Add torrents, monitor downloads, pause/resume, and control your torrent server programmatically with PHP.

Perfect for automation scripts, web-based torrent managers, seedbox dashboards, and PHP applications that need BitTorrent client integration.

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Install](#install)
- [Quick Start](#quick-start)
    - [qBittorrent](#qbittorrent)
    - [Transmission](#transmission)
    - [rTorrent](#rtorrent)
    - [Deluge](#deluge)
    - [rqbit](#rqbit)
    - [aria2](#aria2)
- [Methods](#methods)
- [Driver Status](#driver-status)
- [Drivers](#drivers)
- [Testing](#testing)
    - [Unit Tests](#unit-tests)
    - [Integration Tests](#integration-tests)
- [Custom Driver](#custom-driver)
- [License](#license)

Features
--------

[](#features)

- **Multi-client support** — works with 6 different torrent clients out of the box
- **Single API** — same methods, same return types, regardless of the client
- **Composer-ready** — install in seconds with `composer require fatkulnurk/torrent`
- **PSR-4 autoloading** — clean namespace structure with strict typing
- **Full test coverage** — tested with PHPUnit 11, analysed with PHPStan 2

Install
-------

[](#install)

```
composer require fatkulnurk/torrent
```

Quick Start
-----------

[](#quick-start)

### qBittorrent

[](#qbittorrent)

qBittorrent always requires authentication.

```
use Fatkulnurk\Torrent\TorrentClientManager;

// With auth (required)
$client = TorrentClientManager::make('qbittorrent', 'http://192.168.1.10:8080', [
    'username' => 'admin',
    'password' => 'secret',
]);

$client->addTorrent('magnet:?xt=urn:btih:dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c&dn=Big+Buck+Bunny');
$torrents = $client->getTorrents();
$client->pauseTorrent('hash123');
$client->removeTorrent('hash123', true);
```

### Transmission

[](#transmission)

Transmission supports both authenticated and anonymous mode depending on server configuration.

```
// With auth
$client = TorrentClientManager::make('transmission', 'http://192.168.1.20:9091', [
    'username' => 'admin',
    'password' => 'secret',
]);

// Without auth (if server allows anonymous connections)
$client = TorrentClientManager::make('transmission', 'http://192.168.1.20:9091');

$client->addTorrent('magnet:?xt=urn:btih:dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c&dn=Big+Buck+Bunny');
$torrents = $client->getTorrents();
```

### rTorrent

[](#rtorrent)

rTorrent has no authentication mechanism.

```
// Without auth (default)
$client = TorrentClientManager::make('rtorrent', 'http://192.168.1.30:8080', [
    'rpc_endpoint' => 'RPC2',
]);

$client->addTorrent('magnet:?xt=urn:btih:dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c&dn=Big+Buck+Bunny');
$torrents = $client->getTorrents();
```

> The `rpc_endpoint` option defaults to `RPC2`. Set it to `/` when connecting to rTorrent via an SCGI proxy that serves from root (e.g. port 8000 on the crazymax/rtorrent-rutorrent image).

### Deluge

[](#deluge)

Deluge always requires a password.

```
// With auth (required)
$client = TorrentClientManager::make('deluge', 'http://192.168.1.40:8112', [
    'password' => 'deluge',
]);

$client->addTorrent('magnet:?xt=urn:btih:dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c&dn=Big+Buck+Bunny');
$torrents = $client->getTorrents();
```

### rqbit

[](#rqbit)

rqbit has no authentication by default. Supports pause, resume, remove (with or without files), and detailed torrent info via its REST API. `setDownloadPath` is not supported.

```
// Without auth (default)
$client = TorrentClientManager::make('rqbit', 'http://127.0.0.1:3030');

$client->addTorrent('magnet:?xt=urn:btih:dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c&dn=Big+Buck+Bunny');
$torrents = $client->getTorrents();
$client->pauseTorrent($torrents[0]->hash);
$client->resumeTorrent($torrents[0]->hash);
$client->removeTorrent($torrents[0]->hash, false); // keep files
$client->removeTorrent($torrents[0]->hash, true);  // delete files
```

### aria2

[](#aria2)

aria2 supports both secret-based auth and anonymous mode.

```
// With auth
$client = TorrentClientManager::make('aria2', 'http://127.0.0.1:6800', [
    'secret' => 'your-secret-token',
]);

// Without auth (if server allows)
$client = TorrentClientManager::make('aria2', 'http://127.0.0.1:6800');

$client->addTorrent('magnet:?xt=urn:btih:dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c&dn=Big+Buck+Bunny');
$torrents = $client->getTorrents();
```

Methods
-------

[](#methods)

MethodDescription`addTorrent($source, $options)`Add a torrent (magnet URI, HTTP URL, or base64-encoded .torrent)`getTorrents($filters)`List all torrents`getTorrent($hash)`Get a single torrent's details`pauseTorrent($hash)`Pause a torrent`resumeTorrent($hash)`Resume a torrent`removeTorrent($hash, $deleteFiles?)`Remove a torrent`setDownloadPath($hash, $path)`Change download directory`getServerStatus()`Get server status / versionDriver Status
-------------

[](#driver-status)

MethodqBittorrentTransmissionrTorrentDelugerqbitaria2`addTorrent`✅✅✅✅✅✅`getTorrents`✅✅✅✅✅✅`getTorrent`✅✅✅✅✅✅`pauseTorrent`✅✅✅✅✅✅`resumeTorrent`✅✅✅✅✅✅`removeTorrent`✅✅✅✅✅✅`setDownloadPath`✅✅✅✅❌✅`getServerStatus`✅✅✅✅✅✅**Legend:**

IconMeaning✅Supported and tested❌Not supported by the provider (throws `RequestException`)Drivers
-------

[](#drivers)

DriverClassProtocolAuthDefault Port`qbittorrent``QbittorrentProvider`REST (cookie)username + password8080`transmission``TransmissionProvider`JSON-RPCusername + password (optional)9091`rtorrent``RTorrentProvider`XML-RPCnone8000 (RPC proxy)`deluge``DelugeProvider`JSON-RPCpassword8112`rqbit``RqbitProvider`RESTnone3030`aria2``Aria2Provider`JSON-RPCsecret token (optional)6800Testing
-------

[](#testing)

### Unit Tests

[](#unit-tests)

Run all unit tests (no external services required):

```
make test-unit
# or
php vendor/bin/phpunit tests/Data tests/Exceptions tests/Providers tests/TorrentClientManagerTest.php
```

### Integration Tests

[](#integration-tests)

Integration tests connect to real torrent client instances via Docker. Start all services and run:

```
make setup
make up
make test-integration
```

The `test-integration` target automatically:

1. Starts all containers via Docker Compose
2. Extracts the temporary qBittorrent 5.x password from container logs
3. Passes it as the `QBITTORRENT_PASSWORD` environment variable
4. Runs integration tests against all 6 services

To run integration tests manually:

```
# Start containers
make setup && make up

# Get qBittorrent temp password
docker logs torrent-qbittorrent 2>&1 | grep -oP 'temporary password is provided for this session: \K\S+'

# Run integration tests
QB_PASS= INTEGRATION=true QBITTORRENT_PASSWORD=$QB_PASS php vendor/bin/phpunit tests/integration
```

Available Docker services:

ServiceImageVersionURLAuthqBittorrent`lscr.io/linuxserver/qbittorrent`5.2.0username: `admin`, password: auto-generated (see logs)Transmission`lscr.io/linuxserver/transmission`4.1.1username: `admin`, password: `admin`rTorrentcustom `docker/rtorrent/Dockerfile`0.16.7 (rTorrent) (RPC)none(based on `crazymax/rtorrent-rutorrent:5.2.10-0.16.7`) (Web UI)noneDeluge`lscr.io/linuxserver/deluge`2.1.1password: `deluge`rqbit`ikatson/rqbit`9.0.0-beta.1nonearia2custom `docker/aria2/Dockerfile`1.37.0secret: `secret123`> **Note:** qBittorrent 5.x uses per-session temporary passwords. The password changes on every container restart. Use `make test-integration` to auto-extract it, or run `make qb-password` to view the current password.

Custom Driver
-------------

[](#custom-driver)

```
use Fatkulnurk\Torrent\TorrentClientManager;
use Fatkulnurk\Torrent\Providers\AbstractProvider;

class MyProvider extends AbstractProvider
{
    protected function initialize(): void {}

    public function addTorrent(string $source, array $options = []): bool { /* ... */ }
    // implement other methods...
}

TorrentClientManager::register('custom', MyProvider::class);
$client = TorrentClientManager::make('custom', 'http://...');
```

License
-------

[](#license)

MIT

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance95

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

25d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f01b15f535a737f1952358e3ee9789281cf3208d57039eda0782ef8900c72326?d=identicon)[fatkulnurk](/maintainers/fatkulnurk)

---

Top Contributors

[![fatkulnurk](https://avatars.githubusercontent.com/u/12779618?v=4)](https://github.com/fatkulnurk "fatkulnurk (30 commits)")

---

Tags

aria2bittorrent-downloaderbittorrent-phpbittorrent-pro-peer-to-peerdelugeqbittorrentrqbitrtorrenttorrent-automationtorrent-clitorrent-remotetorrent-sdktransmissionapisdktorrenttransmissionbittorrentqbittorrent

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/fatkulnurk-torrent/health.svg)

```
[![Health](https://phpackages.com/badges/fatkulnurk-torrent/health.svg)](https://phpackages.com/packages/fatkulnurk-torrent)
```

###  Alternatives

[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3751.2M45](/packages/tencentcloud-tencentcloud-sdk-php)[resend/resend-php

Resend PHP library.

596.2M34](/packages/resend-resend-php)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

563.5M10](/packages/checkout-checkout-sdk-php)[clicksend/clicksend-php

351.6M11](/packages/clicksend-clicksend-php)[mozex/anthropic-laravel

Laravel integration for the Anthropic API: facade, config publishing, install command, testing fakes, messages, streaming, tool use, thinking, and batches.

72287.1k1](/packages/mozex-anthropic-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
