shaygan/telegram-bot-api-bundle
Composer 安装命令:
composer require shaygan/telegram-bot-api-bundle
包简介
A simple wrapper for telegram-bot-api.
README 文档
README
A symfony wrapper bundle for Telegram Bot API with some tiny feature.
Install
Via Composer
$ composer require shaygan/telegram-bot-api-bundle @dev
Edit your app/AppKernel.php to register the bundle in the registerBundles() method as above:
class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... // register the bundle here new \Shaygan\TelegramBotApiBundle\ShayganTelegramBotApiBundle() ); } }
Configure the bundle
This bundle was designed to just work out of the box. The only thing you have to configure in order to get this bundle up and running is your bot token.
# app/config/config.yml shaygan_telegram_bot_api: token: xxxxx:yyyyyyyyyyyyyyyyyyyy
If you want to use web-hook, add the bundle's routing configuration in app/config/routing.yml :
shaygan_telegram_bot_api: resource: @ShayganTelegramBotApiBundle/Resources/config/routing.yml
And add your domain name, url prefix (if needed) and you update receiver service name (a sample update receiver is included) to the configuration file:
# app/config/config.yml shaygan_telegram_bot_api: #... webhook: domain: example.com path_prefix: ~ # you can add prefix, if your web site is not on the root update_receiver: shaygan.my_update_receiver # sample update receiver
note: Telegram do not support http, your site should have valid SSL (HTTPS).
Usage
Wherever you have access to the service container :
<?php // get the telegram api as a service $api = $this->container->get('shaygan.telegram_bot_api'); // test the API by calling getMe method $user = $api->getMe(); ?>
Next...
Please refer to Telegram Bot API Official Document for getting infomration about available methods and other informations:
Troubleshooting
If you did all the configurations correctly but still getting errors (Http error 500) even on getMe method, it might be because of SSL Verification. Please make sure you have up-to-date CA root certificate bundle to be used with cURL.
You can configure you CA root certificate bundle by:
- Downloading up-to-date cacert.pem file from cURL website and
- Setting a path to it in your php.ini file, e.g. on Windows:
curl.cainfo=c:\php\cacert.pem
License
The MIT License (MIT). Please see License File for more information.
shaygan/telegram-bot-api-bundle 适用场景与选型建议
shaygan/telegram-bot-api-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.11k 次下载、GitHub Stars 达 22, 最近一次更新时间为 2015 年 07 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「php」 「api」 「bot」 「telegram」 「Telegram-Bot-API」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 shaygan/telegram-bot-api-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 shaygan/telegram-bot-api-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 shaygan/telegram-bot-api-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The bundle for easy using json-rpc api on your project
A PSR-7 compatible library for making CRUD API endpoints
Bundle Symfony DaplosBundle
Alfabank REST API integration
Biblioteca PHP pura para pagamentos SISP/Vinti4 de Cabo Verde.
Zero-dependency raw PHP DNS resolver, domain-ownership verification, and intoDNS/MxToolbox-style diagnostics. Queries authoritative nameservers directly over sockets — never trusts the recursive cache for ownership checks.
统计信息
- 总下载量: 5.11k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 23
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-07-19