rgzone/telegram-bot-bundle
Composer 安装命令:
composer require rgzone/telegram-bot-bundle
包简介
Symfony bundle to inject the most popular Telegram Bot API implementations
README 文档
README
Symfony Bundle to autowire most used Telegram Bot API implementations.
Table of Contents
Install
$ composer require rgzone/telegram-bot-bundle
<?php // config/bundles.php
return [
// ...
RGZ\TelegramBotBundle\RGZTelegramBundle::class => ['all' => true],
];
Configure
# config/packages/rgz_telegram.yaml
rgz_telegram:
bot:
name: bot
token: '%env(TG_TOKEN)%'
# config/packages/rgz_telegram.yaml
rgz_telegram:
default_bot: default
bots:
main:
token: '%env(TG_TOKEN_MAIN)%'
default:
token: '%env(TG_TOKEN_DEFAULT)%'
logger:
token: '%env(TG_TOKEN_LOGGER)%'
Suggested packages
Usage
Install suggestions
$ composer require telegram-bot/api:^2.3
$ composer require irazasyed/telegram-bot-sdk:^3.3
$ composer require longman/telegram-bot:0.64.*
$ bin/console debug:autowiring --all | grep Telegram
Longman\TelegramBot\Telegram (rgzone.telegram_bot.any_name.bot_lng)
Longman\TelegramBot\Telegram $anyName (rgzone.telegram_bot.any_name.bot_lng)
Longman\TelegramBot\Telegram $botMain (rgzone.telegram_bot.bot_main.bot_lng)
Longman\TelegramBot\Telegram $logger (rgzone.telegram_bot.logger.bot_lng)
TelegramBot\Api\BotApi (rgzone.telegram_bot.any_name.bot_api)
TelegramBot\Api\BotApi $anyName (rgzone.telegram_bot.any_name.bot_api)
TelegramBot\Api\BotApi $botMain (rgzone.telegram_bot.bot_main.bot_api)
TelegramBot\Api\BotApi $logger (rgzone.telegram_bot.logger.bot_api)
Telegram\Bot\Api (rgzone.telegram_bot.any_name.bot_sdk)
Telegram\Bot\Api $anyName (rgzone.telegram_bot.any_name.bot_sdk)
Telegram\Bot\Api $botMain (rgzone.telegram_bot.bot_main.bot_sdk)
Telegram\Bot\Api $logger (rgzone.telegram_bot.logger.bot_sdk)
# config/services.yaml
services:
_defaults:
bind:
$testChatId: '%env(TG_CHAT_ID_TEST)%'
<?php // src/Command/TestCommand.php
namespace App\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use TelegramBot\Api\BotApi;
use Telegram\Bot\Api;
use Longman\TelegramBot\Telegram;
use Longman\TelegramBot\Request;
class TestCommand extends Command
{
protected static $defaultName = 'app:test';
protected BotApi $defaultBot;
protected Api $firstBot;
protected Telegram $secondBot;
protected int $testChatId;
public function __construct(BotApi $randomName, Api $botMain, Telegram $logger, int $testChatId)
{
parent::__construct();
$this->defaultBot = $randomName;
$this->firstBot = $botMain;
$this->secondBot = $logger;
$this->testChatId = $testChatId;
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->defaultBot->sendMessage(
$this->testChatId,
'Delivered by "<b>telegram-bot/api</b>"',
'HTML'
);
$this->firstBot->sendMessage([
'chat_id' => $this->testChatId,
'text' => 'Delivered by "<b>irazasyed/telegram-bot-sdk</b>"',
'parse_mode' => 'HTML',
]);
Request::initialize($this->secondBot);
Request::sendMessage([
'chat_id' => $this->testChatId,
'text' => 'Delivered by "<b>longman/telegram-bot</b>"',
'parse_mode' => 'HTML',
]);
return Command::SUCCESS;
}
}
rgzone/telegram-bot-bundle 适用场景与选型建议
rgzone/telegram-bot-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 23 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 11 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 rgzone/telegram-bot-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rgzone/telegram-bot-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 23
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-11-07