Download the PHP package alefsheen/balebotphp without Composer
On this page you can find all versions of the php package alefsheen/balebotphp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download alefsheen/balebotphp
More information about alefsheen/balebotphp
Files in alefsheen/balebotphp
Package balebotphp
Short Description A very simple PHP class to creating Bale API Bots
License MIT
Informations about the package balebotphp
BaleBotPHP
A very simple PHP class for creating Bale API Bot. Compliant with Bale Bot API.
Requirements
- PHP >= 5.3
- Curl extension for PHP5 must be enabled.
- Bale API key, you can get one simply with @BotFather with simple commands right after creating your bot.
For the WebHook:
- An VALID SSL certificate (Bale API requires this). You can use CDNs such as arvancloud or cloudflare which gives free ssl services.
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/alefsheen/BaleBotPHP/releases
Using Git
From a project directory, run:
Installation
Via Composer's autoloader
After downloading by using Composer, you can include Composer's autoloader:
Via BaleBot class
Copy Telegram.php into your server and include it in your new bot script:
Note: To enable error log file, also copy BaleBotErrorLogger.php in the same directory of BaleBot.php file.
Configuration (WebHook)
Navigate to https://tapi.bale.ai/bot(BOT_TOKEN)/setWebhook?url=https://yoursite.com/your_update.php Or use the BaleBot 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.
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 balebotphp with dependencies
ext-json Version *
ext-curl Version *