Download the PHP package miqdadyyy/laraveltelegrambot without Composer
On this page you can find all versions of the php package miqdadyyy/laraveltelegrambot. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download miqdadyyy/laraveltelegrambot
More information about miqdadyyy/laraveltelegrambot
Files in miqdadyyy/laraveltelegrambot
Package laraveltelegrambot
Short Description Telegram Bot for laravel 6
License MIT
Homepage https://github.com/miqdadyyy/laraveltelegrambot
Informations about the package laraveltelegrambot
LaravelTelegramBot
Laravel 6 package to manage Telegram Bot
Preparation
- Create your own bot on BotFather
- Copy your bot key to your .env
TELEGRAM_BOT_KEY=1234567890:Your-Bot-Key
- Run
php artisan config:clear
Installation
Via Composer
Usage
Methods
Get Bot ID
This method is used for get your bot identity
Request Parameter : -
Response :
Get Updates
This method is used for get all of your bot updates. Bot update is message or callback from user to your bot
Request Parameter : -
Response :
Create Message
You can create a message to send a user by chat_id
.
$chat_id
: your client telegram ID (string)$text
: message to your client (string)$options
: a several options to send message (array)
Here is several options available for telegram bot
No | Option | Description | Value |
---|---|---|---|
1 | parse_mode | You can parse your message into HTML or Markdown | 'html' or 'markdown' |
2 | disable_web_page_preview | Disables link previews for links in this message | true or false |
3 | disable_notification | Sends the message silently. Users will receive a notification with no sound. | true or false |
4 | reply_to_message_id | If the message is a reply, ID of the original message | Integer |
5 | reply_markup | Additional interface options, we already make method for this | array |
After creating message with several options, if you want to send the message you should add :
When you want to send message directly, you can use
Inline Keyboard
This object represents one button of an inline keyboard.
Example :
To create Inline Keyboard :
To add lines to the keyboard
But you need to add button each row
There are 2 types inline keyboard button in this package (URL and callback), you can pass a query_callback
or a url
to callback parameters
The complete code to make button like example are :
if you want to add a single button on message just :
Keyboard Button
The keyboard button be like
In this package, keyboard button will always showed up but you can change the button. When button choosed it will only send a message to bot as the title of button
To make this keyboard button more easier than Inline Keyboard
Webhook
This webhook is used to get message from user to your application and you can response their message customly.
Requirements
- You should have a domain with ssl protection (https)
- Your
BASE_URL
on .env should be same with your domain
Install Webhook
- To set webhook url run
php artisan telegrambot:webhook
- then extract the controller by run
php artisan vendor:publish --tag=telegrambot-webhook
- then it will generate a controller on
App\Http\Controllers\TelegramBot\WebhookUpdate.php
Remove Webhook
When you install webhook to your bots, method getUpdates()
will not work for development. To remove webhook just run :
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
License
MIT. Please see the license file for more information.