定制 tegme/tegme 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

tegme/tegme

Composer 安装命令:

composer require tegme/tegme

包简介

Lightweight telegra.ph/api client.

README 文档

README

Packagist License: GPL v3

Tegme is pretty simple in use and lightweight client for api.telegra.ph.

Original API description you can find here.

Contents

Installation

$ composer require tegme/tegme

Requirements

All extension dependencies defined in composer.json:

  • cURL - we need it for making requests to telegra.ph API;
  • JSON - we need it for create requests data for querying telegra.ph API;
  • mbstring - we need it for interaction with multi-byte strings;
  • PHP >= 5.6 - code of this library compatible with PHP since 5.6.

Usage

First of all - you should create a client object:

use Tegme\Telegraph;

$telegraphClient = new Telegraph();

Then - you should create one of the request object, defined in Tegme\Types\Requests\*, e.g.:

use Tegme\Types\Requests\CreateAccount;

$createAccountRequest = new CreateAccount(
    'Example Short Name',
    'Author Name',
    'https://t.me/author_url'
);

Note, that some of requests objects will validate in constructor and may throw exception (Tegme\Exceptions\InvalidRequestsInfoException).

See the exception message about detailed information.

Next step - let's call api.telegra.ph:

/**
 * @var TelegraphResponse $response
 */
$response = $telegraphClient->call($createAccountRequest);

Tegme\Types\TelegraphResponse - is simple wrapper for raw response.

You can get one of the Telegraph type (Tegme\Types\Response\*) via:

/** @var mixed $resultObj */
$resultObj = $response->getResult();

or raw response in array format:

/** @var array $rawResponse */
$rawResponse = $response->getRawResponse();

Note that telegraph client may throw exceptions (Tegme\Exceptions\{TelegraphApiException, CurlException}) while querying on api.telegra.ph

See exceptions messages about detailed information.

You can find all possible client usage here (example folder).

Author

Mazur Alexandr - alexandrmazur96@gmail.com - https://t.me/alexandrmazur96

License

Tegme is licensed under the GNU General Public License - see the LICENSE file for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: AGPL-3.0-only
  • 更新时间: 2019-10-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固