{"id":19112907,"url":"https://github.com/chipslays/telegraph","last_synced_at":"2025-04-30T22:14:46.384Z","repository":{"id":56952071,"uuid":"336343922","full_name":"chipslays/telegraph","owner":"chipslays","description":"📝 PHP client for Telegraph API.","archived":false,"fork":false,"pushed_at":"2023-08-10T11:23:23.000Z","size":69,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"v3.x","last_synced_at":"2025-04-30T22:14:41.303Z","etag":null,"topics":["image-upload","image-uploader","php","telegraph","telegraph-api","telegraph-client","telegraph-publishing"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chipslays.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-05T17:36:49.000Z","updated_at":"2025-04-25T09:23:37.000Z","dependencies_parsed_at":"2024-11-09T04:34:35.721Z","dependency_job_id":null,"html_url":"https://github.com/chipslays/telegraph","commit_stats":{"total_commits":35,"total_committers":2,"mean_commits":17.5,"dds":0.08571428571428574,"last_synced_commit":"1bf1f4e8d1b60164901e368906d7fe2ca891046d"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chipslays%2Ftelegraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chipslays%2Ftelegraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chipslays%2Ftelegraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chipslays%2Ftelegraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chipslays","download_url":"https://codeload.github.com/chipslays/telegraph/tar.gz/refs/heads/v3.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251789618,"owners_count":21644086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["image-upload","image-uploader","php","telegraph","telegraph-api","telegraph-client","telegraph-publishing"],"created_at":"2024-11-09T04:34:29.442Z","updated_at":"2025-04-30T22:14:46.362Z","avatar_url":"https://github.com/chipslays.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Telegraph API Client for PHP \u003e=8.0\n\nTelegraph is an anonymous blogging platform, a free publishing tool created by Telegram.\n\n## Installation\n\nInstall latest 3.x version via Composer.\n\n```bash\ncomposer require chipslays/telegraph\n```\n\n## Usage\n\n### Easy Peasy Mode\n\n```php\n$client = new Telegraph\\Client;\n\n$account = $client-\u003ecreateAccount('johndoe', 'John Doe', 'https://example.com');\n\n$page = $account-\u003ecreatePage('Hello World', 'This is a Hello World example.');\n\necho $page-\u003egetUrl(); // https://telegra.ph/Hello-World-10-21-12\n```\n\n### Hard Mode\n\n```php\nuse Telegraph\\Client;\nuse Telegraph\\Element;\nuse Telegraph\\File;\nuse Telegraph\\Types\\Account;\nuse Telegraph\\Types\\NodeElement;\n\n$client = new Client;\n\n$account = $client-\u003ecreateAccount('johndoe', 'John Doe', 'https://example.com');\n\n$page = $account-\u003ecreatePage(\n    'Rich Example',\n    [\n        Element::text(\"Line 1\\nLine 2\\nLine 3\\n\\n\"),\n        Element::line(),\n        Element::bigHeading(\"H3 text\"),\n        Element::smallHeading(\"H4 text\"),\n        Element::line(),\n        Element::strongText(\"Strong text\\n\"),\n        Element::italicText(\"Itaic text\\n\"),\n        Element::underlineText(\"Underline text\\n\"),\n        Element::strikeText(\"Strike text\\n\"),\n        Element::emphasizedText(\"Em text\\n\"),\n        Element::code(\"Code text\\n\"),\n        Element::link(\"This is link\\n\", 'https://github.com/chipslays/telegraph'),\n        Element::space(), // add a new line otherwise the previous tags will be in heading\n        new NodeElement('h3', [new NodeElement('a', 'This is link in title, wow!', ['href' =\u003e '#'])]),\n        Element::space(), // add a new line otherwise the previous tags will be in blockquote\n        Element::blockquote(\"Blockquote text\\n\"),\n        Element::line(),\n        Element::pre(\"echo 'Hello Pre Text!';\"),\n        Element::line(),\n        Element::smallHeading(\"Items List\"),\n        Element::list(['Item 1', 'Item 2', 'Item 3']),\n        Element::smallHeading(\"Numeric List\"),\n        Element::list(['Item 1', 'Item 2', 'Item 3'], true),\n        Element::line(),\n        Element::image('https://images.unsplash.com/photo-1541963463532-d68292c34b19?ixlib=rb-4.0.3\u0026ixid=MnwxMjA3fDB8MHxleHBsb3JlLWZlZWR8Mnx8fGVufDB8fHx8\u0026w=1000\u0026q=80', 'Image Caption'),\n        // Element::image(File::upload('/path/to/local/image.jpg')),\n        Element::line(),\n        Element::smallHeading(\"Embed Blocks\"),\n        Element::youtube('https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'Youtube Caption'),\n        Element::vimeo('https://vimeo.com/340057344', 'Vimeo Caption'),\n        Element::twitter('https://twitter.com/elonmusk/status/1354174279894642703', 'GAMESTONK!!1!1'),\n        // Element::embed('vendorName', 'https://example.com', 'Universal method for embed.'),\n    ],\n);\n\necho $page-\u003egetUrl(); // https://telegra.ph/Rich-Example-10-21\n```\n\nUpload files to Telegraph server.\n\n```php\nuse Telegraph\\File;\n\n// Returns string\n$imageUrl = File::upload('/path/to/local/image.jpg');\n\n// Can pass url\n$imageUrl = File::upload('https://example.com/image.jpg');\n\n// Returns array with preserved keys\n// ['my_nudes' =\u003e 'https://telegra.ph/*, ....]\n$imageUrl = File::upload([\n    'my_nudes' =\u003e '/path/to/local/image.jpg',\n    'home_video_with_my_gf' =\u003e '/path/to/local/video.mp4',\n]);\n```\n\n## Examples\n\nYou can found examples [here](/examples).\n\n[Here](/examples) are really almost all [popular use cases](/examples) Telegraph API.\n\n## Documentation\n\nNot found.\n\nSo, code **well documencated**, `Client` class supports all methods of Telegraph API, just start typing e.g. `$client-\u003ecreateAccount(...)` and your IDE helps you.\n\nUse the `Element` helper class to create rich content or use raw `NodeElement` for more flexible stuff.\n\n`Element` class uses `NodeElement` under the hood. \n\nSee how it work [here](/src/Element.php).\n\nGood luck stanger.\n\n## License\n\nThe MIT License (MIT). Please see [License File](/LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchipslays%2Ftelegraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchipslays%2Ftelegraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchipslays%2Ftelegraph/lists"}