1. Go to this page and download the library: Download fatkulnurk/torrent library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Fatkulnurk\Torrent\TorrentClientManager;
use Fatkulnurk\Torrent\Providers\AbstractProvider;
use Fatkulnurk\Torrent\Data\Torrent;
use Fatkulnurk\Torrent\Data\ServerStatus;
class MyProvider extends AbstractProvider
{
protected function initialize(): void {}
public function addTorrent(string $source, array $options = []): bool { /* ... */ }
public function getTorrents(array $filters = []): array { /* ... */ }
public function getTorrent(string $hash): Torrent { /* ... */ }
public function pauseTorrent(string $hash): bool { /* ... */ }
public function resumeTorrent(string $hash): bool { /* ... */ }
public function removeTorrent(string $hash, bool $deleteFiles = false): bool { /* ... */ }
public function setDownloadPath(string $hash, string $path): bool { /* ... */ }
public function getServerStatus(): ServerStatus { /* ... */ }
}
TorrentClientManager::register('custom', MyProvider::class);
$client = TorrentClientManager::make('custom', 'http://...');
bash
make test-unit
# or
php vendor/bin/phpunit tests/Data tests/Exceptions tests/Providers tests/TorrentClientManagerTest.php
bash
make setup && make up
docker logs torrent-qbittorrent 2>&1 | grep -oP 'temporary password is provided for this session: \K\S+'
QB_PASS=<password> INTEGRATION=true QBITTORRENT_PASSWORD=$QB_PASS php vendor/bin/phpunit tests/integration
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.