webtor/platform-sdk-php

SDK for online torrent streaming

v0.1.5 2020-09-12 11:23 UTC

This package is auto-updated.

Last update: 2024-03-12 18:50:45 UTC


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.