Awesome Open Source
Awesome Open Source

📝 PHP Telegraph API Client

Packagist Version GitHub

PHP client for Telegra.ph API.

Installation

$ composer require chipslays/telegraph

Usage

Telegraph API

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());

Upload files

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
// )

Examples

See examples here.

Methods

See all available methods here.

See all predefined elements here.

TODO

  • Write tests 😴💤

Credits

License

The MIT License (MIT). Please see License File for more information.

Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Php (284,330
Image Uploader (172
Image Upload (100
Telegraph (53
Telegraph Api (23
Telegraph Publishing (4