Package to integrate PHP Telegram Bot library in Laravel 6.x
jahanzaibbahadur/laravel-telegram-bot is a Laravel package for package to integrate php telegram bot library in laravel 6.x.
It currently has 0 GitHub stars and 4 downloads on Packagist (latest version 1.1.1).
Install it with composer require jahanzaibbahadur/laravel-telegram-bot.
Discover more Laravel packages by jahanzaibbahadur
or browse all Laravel packages to compare alternatives.
Last updated
This package helps easily integrate PHP Telegram Bot library in Laravel application.
Install this package through Composer.
Edit your project's composer.json file to require php-telegram-bot/laravel
Create composer.json file:
{
"name": "yourproject/yourproject",
"type": "project",
"require": {
"php-telegram-bot/laravel": "^1.0"
}
}
And run composer update
Or run a command in your command line:
composer require php-telegram-bot/laravel
Copy the package config and migrations to your project with the publish command:
php artisan vendor:publish --provider="PhpTelegramBot\Laravel\ServiceProvider"
After run migration command
php artisan migrate
In the config you have to specify Telegram API KEY
You can inject PhpTelegramBot\Laravel\PhpTelegramBotContract in anywhere and use bot instance
For example:
<?php
namespace App\Http\Controllers;
use PhpTelegramBot\Laravel\PhpTelegramBotContract;
class CustomController extends Controller
{
public function handle(PhpTelegramBotContract $telegramBot)
{
// Call handle method
$telegramBot->handle();
// Or set webhook
$hookUrl = 'https://hook.url';
$telegramBot->setWebhook($hookUrl);
// Or handle telegram getUpdates request
$telegramBot->handleGetUpdates();
}
}
More details about usage you can see on the PHP Telegram Bot docs: https://github.com/php-telegram-bot/core#instructions
write more tests
If you like living on the edge, please report any bugs you find on the php-telegram-bot/laravel issues page.
Pull requests are welcome. See CONTRIBUTING.md for information.
Please see the LICENSE included in this repository for a full copy of the MIT license, which this project is licensed under.
Full credit list in CREDITS