chipslays/telegraph 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

chipslays/telegraph

最新稳定版本:5.0.1

Composer 安装命令:

composer require chipslays/telegraph

包简介

Telegraph API Client for PHP

README 文档

README

Modern PHP library for Telegraph API. Telegraph is a minimalist anonymous publishing platform created by Telegram. Create beautiful articles in seconds without registration.

Features

  • 🚀 Simple & Intuitive API - Fluent interface for easy content building
  • 🎨 Rich Content Support - Headers, paragraphs, lists, images, videos, code blocks
  • 🔄 HTML Conversion - Automatic HTML to Telegraph format conversion with sanitization
  • 🛡️ Type Safe - Full PHP 8.1+ type hints with readonly properties
  • 📝 Fully Documented - Comprehensive PHPDoc comments for IDE support

Requirements

  • PHP 8.1 or higher
  • cURL extension
  • JSON extension

Installation

Install via Composer:

composer require chipslays/telegraph

Quick Start

use Telegraph\Telegraph;

// Create client
$telegraph = new Telegraph;

// Create account
$account = $telegraph->createAccount(
    shortName: 'MyBlog',
    authorName: 'John Doe'
);

// IMPORTANT: Save this token!
$token = $account->accessToken();

// Create page
$page = $account->createPage(
    title: 'Hello World',
    content: 'My first Telegraph article!'
);

echo "Published: " . $page->url();
$html = <<<HTML
    <h1>Article Title</h1>
    <p>Introduction with <strong>bold</strong> text.</p>
    <img src="https://example.com/image.jpg" />
    <p>Regular paragraph with <a href="https://example.com">link</a>.</p>
    <ul>
        <li>First item</li>
        <li>Second item</li>
    </ul>
    <blockquote>Important quote</blockquote>
HTML;

$page = $account->createPageFromHtml('Blog Post', $html);

Usage Examples

You can find code examples in examples folder or in EXAMPLES.md.

License

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

统计信息

  • 总下载量: 680
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-02-05