al3x5/xbot-laravel
最新稳定版本:v0.1.1
Composer 安装命令:
composer require al3x5/xbot-laravel
包简介
Laravel integration for xBot library
README 文档
README
Seamless integration of xBot the powerful PHP library for creating Telegram bots with the Laravel framework.
🚀 Features
- Artisan Commands: Use xBot through familiar Laravel commands
- Laravel Cache Integration: Automatic PSR-16 adapter
- Laravel Configuration: Native Laravel configuration system
- API Ready: Automatic Laravel Sanctum configuration
- Webhook Management: Easy webhook configuration for Telegram bots
📦 Installation
composer require al3x5/xbot-laravel
⚡ Quick Start
1. Install and Configure
php artisan xbot
This command will:
- Configure the Laravel API (Sanctum)
- Publish the xBot configuration
- Guide you through setting up your bot
- Adapt the configuration for your environment Laravel
2. Configure Webhook
php artisan xbot:hook:set https://yourdomain.com/xbot/webhook
3. Create Your First Command
php artisan xbot telegram:command HelloWorld
4. Register all commands and callbacks
php artisan xbot register
🛠 Available Commands
All commands available in xBot, except php vendor/bin/xbot install. This command is replaced by php artisan xbot.
⚙️ Settings
After installation, add to your .env:
BOT_TOKEN=1234567890:ABCDEFGHIJKLMNOQRSTZ
ADMIN_TELEGRAM_ID=123456789,985632147
🌐 Webhook Route
Add to your routes/api.php:
use Illuminate\Http\Request; use Illuminate\Support\Facades\Route; Route::post('/bot', function (Request $request) { $bot = new Al3x5\xBot\Bot(config('xbot')); $bot->run(); });
🔧 Advanced Use
Custom Integration
Inject xBot services into your controllers:
use H3x5\xBot\Bot; public function sayHelloWorld(Request $request, Bot $bot) { return $bot->sendMessage([ 'chat_id' => 'CHAT_ID', 'text' => 'Hello World' ]); }
📚 Requirements
- PHP 8.2+
- Laravel 12.x
- xBot Library (automatically installed)
🆘 Support
📄 License
MIT License - see the LICENSE file for details.
Need help? Open an issue on GitHub or consult the xBot documentation.
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-28