hosseinhunta/php-telegram-api-bot
Composer 安装命令:
composer require hosseinhunta/php-telegram-api-bot
包简介
A PHP SDK for Telegram Bot API with full method support and robust error handling
README 文档
README
Telegram Bot API - PHP SDK (Beta)
This is a PHP SDK for the Telegram Bot API, designed to make building Telegram bots as easy and fun as possible! Whether you're a beginner or an experienced developer, this library is built with simplicity, security, and performance in mind. It comes packed with features, tons of examples, and—most importantly—a detailed documentation site that shows you just how simple it is to create Telegram bots with PHP.
We’ve worked hard to make this library a go-to tool for anyone looking to create Telegram bots without the hassle. It’s lightweight, secure, and optimized for real-world use cases, so you can focus on building your bot instead of wrestling with complicated code.
Supported Telegram Bot API Methods
This SDK currently supports all Telegram Bot API methods! Here’s a quick overview:
| Method | Supported |
|---|---|
sendMessage |
✅ |
getMe |
✅ |
sendPhoto |
✅ |
sendAudio |
✅ |
sendDocument |
✅ |
sendVideo |
✅ |
sendAnimation |
✅ |
sendVoice |
✅ |
sendVideoNote |
✅ |
sendMediaGroup |
✅ |
getUpdates |
✅ |
setWebhook |
✅ |
deleteWebhook |
✅ |
getChat |
✅ |
getChatMember |
✅ |
answerCallbackQuery |
✅ |
| ...and more! | ✅ |
Yes, you read that right—every method in the Telegram Bot API is supported in this SDK! 🎉
Documentation
Want to dive deeper? Check out our detailed documentation, available in two languages:
The docs will guide you through everything—from installation to advanced usage—with plenty of examples to get you started.
TODO: Upcoming Features
We’re working hard to make this SDK even better! Here’s what’s on the horizon:
- Build a command and event handler for better bot management.
- Optimize the update handler for smoother performance.
- Enhance code security and stability.
- Complete and polish the documentation.
- Update the SDK to support Telegram Bot API version 8.3.
- Add support for complex data types.
- Introduce middleware for advanced request handling.
- Improve webhook management with advanced features.
- Add advanced debugging tools (e.g., direct request/response dumping).
- Implement extensive unit tests and integration tests to ensure stability.
- Add plugin support for extending functionality.
- Further optimize performance for large-scale bots.
- Add support for inline query caching to reduce API calls.
- Create a built-in rate limiter to handle Telegram API limits.
- Add support for multi-bot management in a single instance.
Stay tuned for these updates as we continue to improve the SDK! 🚀
Repository Creator's Note
Hey there! Yep, it’s me again—another Telegram bot library. But you might be wondering: why create yet another one? What’s wrong with the existing libraries? And what makes this one different?
These days, I’m going through a pretty strange phase in my life—a time when I don’t have much free time to dive into my true passion: coding. I really wanted to kick off my first GitHub repository with something meaningful, something that reflects the very first library I ever wrote. After coming back from some personal challenges (and a 12-day break), I thought, “How can I enjoy coding again while solving one of my problems?” During that time, I listened to a lot of music, and I got this idea to create a Telegram channel that could act like a playlist for me. I wanted a bot that could upload music links or files I send it as files in the channel, so I could always listen to them and share them with others. Plus, I wanted it to create a playlist for my favorite music platform.
When I started working on this with my old library, I realized how much room for improvement there was. So, I put the bot idea on hold and focused on building a better library instead. My goal? To create a comprehensive and complete library—at least a beta version—that can stand toe-to-toe with other similar libraries out there! When I say “comprehensive,” I mean it should have super clear, simple, and easy-to-understand documentation. So, I set my priorities: simplicity, security, tons of features, optimization, lots of examples, and—most importantly—a documentation site that shows everyone just how easy it is to build a Telegram bot with PHP.
Now, you might ask: why PHP? Why not Python, JavaScript, or even Dart—a language I’ve been working with a lot lately and absolutely love? Well, the first language I ever learned (at a very basic level) was PHP. Then I moved on to Python, and since the first library I ever wrote was in Python, I wanted to go back to those early days when I first fell in love with programming. So, I decided to build this with PHP. Plus, it’s a great chance to level up my PHP skills! Honestly, PHP 8.4 has made the language so much more exciting, and I’m done throwing shade at it.
As I’m writing this, I’ve got 3 days left of my break. My plan is to release a beta version in these 3 days and finally build that music bot I’ve been dreaming about. I hope this library keeps moving forward! :)
Awesome Telegram Bots Built with Telegram Bot SDK!
Have you built a cool Telegram bot using this SDK? Let us know, and we’ll feature it here! Stay tuned for a growing list of awesome bots created by the community.
Additional Information
Any issues, feedback, suggestions, or questions? Please use the issue tracker here.
Contributing
Thank you for considering contributing to the project! Please review the CONTRIBUTING guidelines before submitting any pull requests.
Credits
This project was created by HossienHunTa.
Disclaimer
This SDK is currently in beta, and while we’ve done our best to ensure it works smoothly, there might be bugs or unexpected behavior. Use it at your own risk, and feel free to report any issues you encounter.
License
This project is licensed under the MIT License—feel free to use, modify, and distribute it as you like!
hosseinhunta/php-telegram-api-bot 适用场景与选型建议
hosseinhunta/php-telegram-api-bot 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 04 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 hosseinhunta/php-telegram-api-bot 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hosseinhunta/php-telegram-api-bot 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-08
