PHP code example of laraxgram / laraquest

1. Go to this page and download the library: Download laraxgram/laraquest library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

laraxgram / laraquest example snippets


$_ENV["BOT_TOKEN"] = "123456789:ABcdEfGHigKLMnopQrStuvWXYZ"; // lt-optional

// Polling
$_ENV["sleep_interval"] = 0.5; // default-optional
$_ENV["timeout"] = 100; // default-optional
$_ENV["limit"] = 100; // default-optional
$_ENV["allow_updates"] = ["*"]; // default-optional

use LaraGram\Laraquest\Methode;

class MyBotClass {
    use Methode;
}

$bot = new MyBotClass();
$bot->sendMessage(123456789, 'hello!');

use LaraGram\Laraquest\Updates;

class MyBotClass {
    use Updates;
}

$bot = new MyBotClass();
$chatID = $bot->message->chat->id;

use LaraGram\Laraquest\Methode;
use LaraGram\Laraquest\Updates;

class MyBotClass {
    use Methode, Updates;
}

$bot = new MyBotClass();
$bot->sendMessage($bot->message->chat->id, 'hello!');

Laraquest::polling(function(Laraquest $request){
    $request->sendMessage($request->message->chat->id, "Hello, Laraquest!")
});