PHP client for Telegra.ph API.
$ composer require chipslays/telegraph
use Chipslays\Telegraph\Client;
require __DIR__ . '/vendor/autoload.php';
$client = new Client;
/** create new account */
$account = $client->createAccount('chipslays');
$token = $account->getAccessToken(); // store this token in safe place for reuse
/** create new page */
$page = $client->createPage($token, 'New page', 'Hello world!');
print_r($page->toArray());
use Chipslays\Telegraph\File;
require __DIR__ . '/vendor/autoload.php';
$links = File::upload('video.mp4');
$links = File::upload('nudes.jpg');
$links = File::upload(['video.mp4', 'nudes.jpg']);
// helper function
$links = upload_files('video.mp4');
$links = upload_files(['video.mp4', 'image.png']);
print_r($links);
// Array
// (
// [0] => https://telegra.ph/file/xxxxxxxxxx.mp4
// [1] => https://telegra.ph/file/xxxxxxxxxx.png
// )
See examples here.
See all available methods here.
See all predefined elements here.
The MIT License (MIT). Please see License File for more information.