webtor / platform-sdk-php
SDK for online torrent streaming
Fund package maintenance!
Patreon
Requires
- php: >=5.3.0
- ext-grpc: *
- ext-protobuf: *
- firebase/php-jwt: ^5.0
- grpc/grpc: ^1.27
Requires (Dev)
- phpunit/phpunit: ^9
README
Webtor.io platform SDK for online torrent streaming
Installation
composer require webtor/platform-sdk-php
grpc
and protobuf
pecl exstensions must be installed, just follow this guide!
Basic usage
<?php require __DIR__ . '/vendor/autoload.php'; $torrentUrl = 'https://github.com/webtorrent/webtorrent.io/blob/master/static/torrents/sintel.torrent?raw=true'; $data = file_get_contents($torrentUrl); $sdk = new Webtor\SDK([ 'apiUrl' => 'https://api.webtor.io', // 'grpcAddr' => '127.0.0.1:50051', 'grpcAddr' => 'grpc.webtor.io:443', 'apiKey' => 'your_api_key', 'secret' => 'your_secret', 'grpcCredentials' => \Grpc\ChannelCredentials::createSsl(), ]); $infoHash = $sdk->torrent()->push($data); $url = $sdk->seeder($infoHash)->url('/Sintel/Sintel.mp4'); echo($url);
Full example can be found there.
Authentication
You don't have to provide api-keys and secrets if you host webtor-instance on your own. Just follow this guide to setup it.
WIP
Currently PHP SDK doesn't provide full functionality as an JavaScript-version. But it will.