PHP code example of erfanvahabpour / bale-bot-sdk

1. Go to this page and download the library: Download erfanvahabpour/bale-bot-sdk 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/ */

    

erfanvahabpour / bale-bot-sdk example snippets


$Bale = new Api($token);

$response = $Bale->getMe(); // return User object

$Bale = new Api($token);

$response = $Bale->sendMessage([
    'chat_id' => '2100855301',
    'text' => 'This is a text.'
]); // return Message object

use EFive\Balle\Laravel\Facades\Bale;

$response = Bale::sendMessage([
    'chat_id' => '2100855301',
    'text' => 'This is a text.'
]); // return Message object

$Bale = new Api($token);

$response = $Bale->getChat([
    'chat_id' => '2100855301'
]); // return User object

echo $response->getFirstName();

use EFive\Bale\BotsManager;

$config = [
    'bots' => [
        'firstBot' => [
            'token' => $firstBotToken,
        ],
        'secondBot' => [
            'token' => $secondBotToken,
        ],
    ]
];

$bale = new BotsManager($config);

// getMe Method
$response = $bale->bot('firstBot')->getMe(); // return User object