salimid/php-telegraph-client

The PHP Telegraph Client is a set of simple classes to interact with Telegra.ph.

v0.1.0 2023-01-04 12:26 UTC

This package is auto-updated.

Last update: 2024-04-04 15:13:32 UTC


README

The PHP Telegraph Client is a set of simple classes to interact with Telegra.ph.

Installation

composer require salimid/php-telegraph-client

Usage

use SalimId\Telegraph\Account;
use SalimId\Telegraph\Page;

$account = Account::create([
    'short_name' => 'John',
    'author_name' => 'John Doe',
]);

$account = Account::find('d3b25feccb89e508a9114afb82aa421fe2a9712b963b387cc5ad71e58722');

$account->short_name = 'JD';
$account->save()->revoke();

$page = $account->page()->create(['title' => 'Hello World']);

$pages = $account->pages();

$page = $pages->first()->refresh();
$page->title = 'My First Post';
$page->save();

$account->use();

$page = Page::find('Path-to-Page-XX-XX');

$page = new Page;
$page->title = 'My Second Post';
$page->save();

$popular = $account->pages()->sortBy('views')->reverse()->first()->refresh();
$popular->title = 'This Post Got ' . $popular->views . ' Views';
$popular->save();

License

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