PHPackages                             anton-am/telegraph - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. anton-am/telegraph

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

anton-am/telegraph
==================

Simple telegraph posting library

1.0.3(3y ago)6665MITPHPPHP ^7.4 || ^8.0

Since Aug 26Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Anton-Am/telegraph)[ Packagist](https://packagist.org/packages/anton-am/telegraph)[ RSS](/packages/anton-am-telegraph/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (4)Dependencies (4)Versions (5)Used By (0)

PHP Telegraph Library
=====================

[](#php-telegraph-library)

A simple php library for integration with [telegra.ph](https://telegra.ph/)

[![Latest Stable Version](https://camo.githubusercontent.com/69c276d15e457571d7118fdb3070ff0b6110387cac6c3477d82a97ac973c6848/68747470733a2f2f706f7365722e707567782e6f72672f616e746f6e2d616d2f74656c6567726170682f762f737461626c65)](https://packagist.org/packages/anton-am/telegraph)[![Total Downloads](https://camo.githubusercontent.com/d1b59e05566f48449acf797ad9d899b8109daa58a2b7fdbcf101093c05e31649/68747470733a2f2f706f7365722e707567782e6f72672f616e746f6e2d616d2f74656c6567726170682f646f776e6c6f616473)](https://packagist.org/packages/anton-am/telegraph)

Contents
--------

[](#contents)

- [Installation](#installation)
- [Usage](#usage)
- [Credits](#credits)
- [License](#license)

Installation
------------

[](#installation)

### Raw composer install

[](#raw-composer-install)

```
composer require anton-am/telegraph
```

### composer.json

[](#composerjson)

```
"anton-am/telegraph": "^1"
```

### Connecting

[](#connecting)

```
//COMPOSER:
require_once("vendor/autoload.php");
```

Usage
-----

[](#usage)

### Creating new account with random login

[](#creating-new-account-with-random-login)

```
$telegraph = new \AntonAm\Telegraph\Manager();
$newAccount = $telegraph->account()->create();

/**
 AntonAm\Telegraph\Entities\Account Object
(
    [short_name] => u6127bedb238ee
    [author_name] =>
    [author_url] =>
    [access_token] => 6dce6d496dbdd6770c28e44b25539d48df0cc08d191f7b499b88ef0872ed
    [auth_url] => https://edit.telegra.ph/auth/5ckd5ECGzB0KpCpu9I8H0fyJ4f1SrZyw9RJetjT1UR
    [page_count] =>
)
 */
```

All available options:

###### create(YOUR\_USER\_TOKEN, YOUR\_USER\_NAME, YOUR\_USER\_PUBLIC\_URL);

[](#createyour_user_token-your_user_name-your_user_public_url)

### Other account methods

[](#other-account-methods)

```
$telegraph = new \AntonAm\Telegraph\Manager('ACCESS_TOKEN_FROM_CREATE');

//Get user information
$account = $telegraph->account()->get();

//Edit user information
$account = $telegraph->account()->edit('NewShortName', 'NewPublicName', 'https://new.url');

//Revoke/reload user access token
$account = $telegraph->account()->revoke();

//List of user pages
$account = $telegraph->account()->pages();
```

### Creating new page without author

[](#creating-new-page-without-author)

```
//Create new account and page
$telegraph = new \AntonAm\Telegraph\Manager();
$page = $telegraph->page()->setTitle('Sed')
    ->addText('Duis arcu tortor, suscipit eget, imperdiet nec, imperdiet iaculis, ipsum. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.')
    ->create();
```

### Edit page

[](#edit-page)

```
$telegraph = new \AntonAm\Telegraph\Manager('b7316e15f67fe9a397ea8b151d5e15a75a9702e2472775fc3ab0e418467d');
$page = $telegraph->page('Test-08-26-233')
    ->setAuthor('User Name', 'https://www.google.com/')
    ->setTitle('Nunc egestas augue')
    ->addText('Nunc sed turpis. Praesent blandit laoreet nibh.

Nam at tortor in tellus interdum sagittis. Quisque id odio.

Aliquam lobortis. Pellentesque libero tortor, tincidunt et, tincidunt eget, semper nec, quam.')
    ->addLink('Telegraph', 'https://telegra.ph')
    ->addImage('http://telegra.ph/file/6a5b15e7eb4d7329ca7af.jpg')
    ->addHtml('hr')
    ->addHtml('h3', 'Header')
    ->edit();
```

All available methods:

###### setAuthor(); //Autofill of name and url from account (if exist)

[](#setauthor-autofill-of-name-and-url-from-account-if-exist)

###### setAuthor(USER\_NAME, USER\_URL);

[](#setauthoruser_name-user_url)

###### addText(YOUR\_TEXT);

[](#addtextyour_text)

###### addImage(IMAGE\_URL);

[](#addimageimage_url)

###### addLink(URL\_NAME, URL\_HREF);

[](#addlinkurl_name-url_href)

###### addHtml(TAG, TEXT, ATTRIBUTES)

[](#addhtmltag-text-attributes)

### Other account methods

[](#other-account-methods-1)

```
$telegraph = new \AntonAm\Telegraph\Manager('b7316e15f67fe9a397ea8b151d5e15a75a9702e2472775fc3ab0e418467d');

//Page views statistic
$page = $telegraph->page('Test-08-26-233')->statistic();

//Page data
$page = $telegraph->page('Test-08-26-233')->get();
```

All available methods:

###### statistic(?YEAR, ?MONTH, ?DAY, ?HOUR);

[](#statisticyear-month-day-hour)

### Handling Errors

[](#handling-errors)

```
try {
    $telegraph = new \AntonAm\Telegraph\Manager();
    $newAccount = $telegraph->page()->setTitle('New page')->create('/new');
} catch (\AntonAm\Telegraph\Exceptions\NodeException $e) {
    //Custom tag problem
} catch (\AntonAm\Telegraph\Exceptions\PageException $e) {
    //Page command problem
} catch (\AntonAm\Telegraph\Exceptions\TelegraphRequestException $e){
    //Telegraph exception problem
} catch (\Exception $e) {
    //Common problem catcher: guzzle, json decode or something else
}
```

Credits
-------

[](#credits)

- [Anton Am](https://github.com/Anton-Am)

License
-------

[](#license)

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

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~177 days

Total

4

Last Release

1193d ago

PHP version history (2 changes)1.0.0PHP ~7.3

1.0.1PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/af13af0d5187f733f6b7cb67a3dc40b5df3c7e1783d4aa5b7023d8ff4f2471c0?d=identicon)[Anton-Am](/maintainers/Anton-Am)

---

Top Contributors

[![Anton-Am](https://avatars.githubusercontent.com/u/2063230?v=4)](https://github.com/Anton-Am "Anton-Am (10 commits)")[![spyke113](https://avatars.githubusercontent.com/u/9079917?v=4)](https://github.com/spyke113 "spyke113 (2 commits)")

---

Tags

phptelegraphphptelegraph

###  Code Quality

TestsCodeception

### Embed Badge

![Health badge](/badges/anton-am-telegraph/health.svg)

```
[![Health](https://phpackages.com/badges/anton-am-telegraph/health.svg)](https://phpackages.com/packages/anton-am-telegraph)
```

###  Alternatives

[stevebauman/location

Retrieve a user's location by their IP Address

1.3k7.6M65](/packages/stevebauman-location)[aimeos/aimeos-base

Aimeos base layer for abstracting from host environments

2.1k134.0k1](/packages/aimeos-aimeos-base)[gehrisandro/tailwind-merge-laravel

TailwindMerge for Laravel merges multiple Tailwind CSS classes by automatically resolving conflicts between them

341682.2k18](/packages/gehrisandro-tailwind-merge-laravel)[obs/esdk-obs-php

OBS PHP SDK

58121.1k3](/packages/obs-esdk-obs-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
