承接 madmagestelegram/client 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

madmagestelegram/client

最新稳定版本:0.6.0

Composer 安装命令:

composer require madmagestelegram/client

包简介

Telegram bot client

README 文档

README

Telegram client for php. Based on telegram bot types

Install

composer require madmagestelegram/client

Usage

// Basic client instance,
// its possible redefine guzzle client on second argument with own options, if necessary
$client = new \MadmagesTelegram\Client\Client('BOT_TOKEN');

// Chat id.
// Usually received in webhook or (https://core.telegram.org/bots/api#getupdates)
$chatId = 0;

// Simple text message
$client->sendMessage($chatId, 'Hello world');

// Simple text + disable message notification
$client->sendMessage($chatId, 'Here is silent message', null, null, null, true);


// It`s possible to send a file
$file = new \MadmagesTelegram\Types\Type\InputFile('/var/photos/some-photo.jpg');

// Here we can send "photo" as photo
$client->sendPhoto($chatId, $file);
// or document
$sentMessage = $client->sendDocument($chatId, $file);

// $sentMessage is instance of \MadmagesTelegram\Types\Type\Message
// As we send document in few lines upper, the property "document" is filled in returned message,
// so we can print it, accessing by getter
print_r($sentMessage->getDocument());

// it prints something like...
// MadmagesTelegram\Types\Type\Document Object
// (
//     [fileId:protected] => ...
//     [fileUniqueId:protected] => ...
//     [thumb:protected] => ...
//     [fileName:protected] => ...
//     [mimeType:protected] => ...
//     [fileSize:protected] => ...
// )

API

All methods definitions defined here

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-08-18