Download the PHP package nullform/telegraphus without Composer
On this page you can find all versions of the php package nullform/telegraphus. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nullform/telegraphus
More information about nullform/telegraphus
Files in nullform/telegraphus
Package telegraphus
Short Description PHP SDK for Telegraph API
License MIT
Homepage https://github.com/nullform/telegraphus
Informations about the package telegraphus
Telegraphus
The PHP package to interact with Telegra.ph.
Telegra.ph is a minimalist publishing tool that allows you to create richly formatted posts and push them to the Web in just a click.
Requirements
- PHP >= 5.6
Installation
Usage examples
First you need to create an account and get an access token:
Next, you can create pages using the parser to convert your HTML code into Telegra.ph format.
After a successful request, Telegra.ph will create a page with the title "Test Page" and the following content:
You can pass HTML code as content to the createPage() method. But then the HTML code will be converted to Telegra.ph format "as is", without replacing tags.
Don't forget that Telegra.ph doesn't support all tags, only the following: a, aside, b, blockquote, br, code, em, figcaption, figure, h3, h4, hr, i, iframe, img, li, ol, p, pre, s, strong, u, ul, video.
And now you can get a list of all your pages:
If you want to edit one:
Methods
ApiClient
- ApiClient::__construct(?string $token = null)
- ApiClient::setToken(?string $token): ApiClient
- ApiClient::getToken(): ?string
- ApiClient::getCurlOptions(): array
- ApiClient::setCurlOptions(array $curlOptions): ApiClient
- ApiClient::setCurlOption(int $option, mixed \$value): ApiClient
- ApiClient::getCurlInfo(): array
- ApiClient::createAccount(Account $account): Account
- ApiClient::editAccountInfo(Account $account): Account
- ApiClient::getAccountInfo(): Account
- ApiClient::revokeAccessToken(): Account
- ApiClient::createPage(string \$title, NodeElement[]|string \$content, ?string \$authorName = null, ?string \$authorUrl = null): Page
- ApiClient::editPage(string \$path, string \$title, NodeElement[]|string \$content, ?string \$authorName = null, ?string \$authorUrl = null): Page
- ApiClient::getPage(string $path): Page
- ApiClient::getPageList(int \$offset = 0, int \$limit = 50): PageList
- ApiClient::getViews(string $path, ?GetViewsParams \$params): PageViews
Parser
- Parser::addTagReplaceRule(string $tag, string \$toTag): Parser
- Parser::addTagReplaceRules(array $rules): Parser
- Parser::hasTagReplaceRule(string $tag): bool
- Parser::getTagReplaceRule(string $tag): string|false|null
- Parser::setAllowedAttributes(?string[] $attributes): Parser
- Parser::setDisallowedAttributes(string[] $attributes): Parser
- Parser::htmlToTelegraphContent(string $html): NodeElement[]|string[]
- Parser::telegraphContentToHtml(NodeElement[] $content): string
- Parser::decodeTelegraphContent(string $json): NodeElement[]
Tests
Tested on PHP 5.6, 7.2 and 8.0.
All versions of telegraphus with dependencies
ext-json Version *
ext-curl Version *
ext-dom Version *
ext-libxml Version *