Download the PHP package usmonaliyev/telegrambotphp without Composer
On this page you can find all versions of the php package usmonaliyev/telegrambotphp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download usmonaliyev/telegrambotphp
More information about usmonaliyev/telegrambotphp
Files in usmonaliyev/telegrambotphp
Package telegrambotphp
Short Description A very simple PHP Telegram Bot API for Laravel
License MIT
Informations about the package telegrambotphp
TelegramBotPHP
This package copy of eleirbag89/telegrambotphp
A very simple PHP Telegram Bot API.
Compliant with the November 17, 2017 Telegram Bot API update.
Requirements
- PHP >= 5.3
- Curl extension for PHP5 must be enabled.
- Telegram API key, you can get one simply with @BotFather with simple commands right after creating your bot.
For the WebHook:
- An VALID SSL certificate (Telegram API requires this). You can use Cloudflare's Free Flexible SSL which crypts the web traffic from end user to their proxies if you're using CloudFlare DNS.
Since the August 29 update you can use a self-signed ssl certificate.
For the getUpdates(Long Polling):
- Some way to execute the script in order to serve messages (for example cronjob)
Download
Using Composer
From your project directory, run:
or
Note: If you don't have Composer you can download it HERE.
Using release archives
https://github.com/Eleirbag89/TelegramBotPHP/releases
Using Git
From a project directory, run:
Installation
Via TelegramBotPHP class
Copy Telegram.php into your server and include it in your new bot script:
Note: To enable error log file, also copy TelegramErrorLogger.php in the same directory of Telegram.php file.
Configuration (WebHook)
Navigate to https://api.telegram.org/bot(BOT_TOKEN)/setWebhook?url=https://yoursite.com/your_update.php Or use the Telegram class setWebhook method.
Examples
If you want to get some specific parameter from the Telegram response:
To upload a Photo or some other files, you need to load it with CurlFile:
To download a file on the Telegram's servers
See update.php or update cowsay.php for the complete example. If you wanna see the CowSay Bot in action add it.
If you want to use getUpdates instead of the WebHook you need to call the the serveUpdate
function inside a for cycle.
See getUpdates.php for the complete example.
Functions
For a complete and up-to-date functions documentation check http://eleirbag89.github.io/TelegramBotPHP/
Build keyboards
Telegram's bots can have two different kind of keyboards: Inline and Reply.
The InlineKeyboard is linked to a particular message, while the ReplyKeyboard is linked to the whole chat.
They are both an array of array of buttons, which rapresent the rows and columns.
For instance you can arrange a ReplyKeyboard like this:
using this code:
When a user click on the button, the button text is send back to the bot.
For an InlineKeyboard it's pretty much the same (but you need to provide a valid URL or a Callback data)
This is the list of all the helper functions to make keyboards easily:
Send a custom keyboard. $option is an array of array KeyboardButton.
Check ReplyKeyBoardMarkUp for more info.
Send a custom keyboard. $inline_keyboard is an array of array InlineKeyboardButton.
Check InlineKeyboardMarkup for more info.
Create an InlineKeyboardButton.
Check InlineKeyBoardButton for more info.
Create a KeyboardButton.
Check KeyBoardButton for more info.
Hide a custom keyboard.
Check ReplyKeyBoarHide for more info.
Show a Reply interface to the user.
Check ForceReply for more info.
List of Bots using the library
Let me know using this Issue if you have made a bot using this API, I will add it to this section.
- iHarfBot - Lang: Persian/Farsi
- AsansorBot - Lang: Persian/Farsi
- IDPbot - Lang: Persian/Farsi (Down as 14/10/2019)
- Evil Insult Generator - Lang English/German
- ibelitbot -Lang Persian (Down as 14/10/2019)
- Advanced Pools Bot - Lang Italian/English(Contribute)
- Btn_Bot - Lang pt-BR - Cria botões transparente para publicações.
- DiffSGLaPuntabot DiffGravinaCTbot DiffAdranobot - Lang: it/Italian - Bots to handle Recycling in San Giovanni La Punta, Gravina and Adrano (OpenSource Template https://github.com/Gualty/BOTDifferenziata)
- GoBot
- RaidBot
Emoticons
For a list of emoticons to use in your bot messages, please refer to the column Bytes of this table: http://apps.timwhitlock.info/emoji/tables/unicode
License
This open-source software is distributed under the MIT License. See LICENSE.md
Contributing
All kinds of contributions are welcome - code, tests, documentation, bug reports, new features, etc...
- Send feedbacks.
- Submit bug reports.
- Write/Edit the documents.
- Fix bugs or add new features.
Contact me
You can contact me via Telegram but if you have an issue please open one.
Support me
You can support me using via LiberaPay
or buy me a beer or two using Paypal.
All versions of telegrambotphp with dependencies
ext-json Version *
ext-curl Version *