承接 alexvkokin/telegram-bot-api 相关项目开发

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

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

alexvkokin/telegram-bot-api

最新稳定版本:0.1.0

Composer 安装命令:

composer require alexvkokin/telegram-bot-api

包简介

Telegram Bot Api

README 文档

README

Requirements

  • PHP 8.2 or higher.

Installation

The package could be installed with Composer:

composer require alexvkokin/telegram-bot-api

Example

use Alexvkokin\TelegramBotApi\Client\TelegramClient;
use Alexvkokin\TelegramBotApi\Method\SendMessage;
use Alexvkokin\TelegramBotApi\Method\SendPhoto;
use Alexvkokin\TelegramBotApi\Method\GetMe;
use Alexvkokin\TelegramBotApi\TelegramBotApi;
use Alexvkokin\TelegramBotApi\Type\InputFile;
use GuzzleHttp\Client;
use HttpSoft\Message\RequestFactory;
use HttpSoft\Message\StreamFactory;

require_once __DIR__ . '/../../vendor/autoload.php';

$token = 'YOUR_BOT_TOKEN';
$chatId = 123456789;

// Telegram API BOT client
$api = new TelegramBotApi(
    $token,
    new TelegramClient(
        new Client(),
        new RequestFactory(),
        new StreamFactory(),
    )
);

// get bot info
$method = new GetMe();
$response = $api->send($method);

// send message
$method = new SendMessage(
    chat_id: $chatId,
    text: 'Hello, world!',
);
$response = $api->send($method);

// send local file
$method = new SendPhoto(
    chat_id: $chatId,
    photo: InputFile::withLocalFile(__DIR__.'/../imgs/screen.png', 'screenshot 1'),
);
$response = $api->send($method);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-12