al3x5/xbot-laravel

Laravel integration for xBot library

Installs: 12

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/al3x5/xbot-laravel

v0.1.1 2025-12-11 06:14 UTC

This package is auto-updated.

Last update: 2025-12-11 06:29:39 UTC


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.