code-a1 / phpgraph
A simple and immediate object-oriented library for the official Telegraph API
dev-main
2021-12-29 17:45 UTC
Requires
- php: >=8
- ext-curl: *
- skrtdev/json2: dev-master
This package is auto-updated.
Last update: 2025-03-29 01:11:05 UTC
README
A simple and immediate object-oriented library for the official Telegraph API
📦 Installation
You can easily install PHPGraph with composer, running the following command:
composer require code-a1/phpgraph dev-main
Then you must only require the autoload file in your project, for example:
require "vendor/autoload.php"That's it! Now you can start using the library
🔧 Usage
All the methods of this library are the same of the official Telegraph api, there are also aliases for some objects - such as edit() or get() for Page - and some methods are easier to use - such as createPage
Here's a basic example:
<?php use codea1\PHPGraph; require "vendor/autoload.php"; $client = new PHPGraph\Client("your_access_token"); $page = $client->createPage("Test", "Simple testing page content", ["return_content" => true]); echo $page->edit("Wow, the title is changed!")->url;
✅ Features
- All the methods of the official Telegraph api.
- Aliases for some objects.
- Methods such as createPage and editPage simplified (for example in
$client->createPage("Test", "Text to test")
, you don't have to write all the long and complex "content" field for a simple text such as "Text to test" - You can use every time a different account, for example:
$account = $client->createAccount("Test"); $client->setAccount($account);
- Library Object-Oriented
- All proprety and methods have their PHPDoc comment