1. Go to this page and download the library: Download arashabedii/telebot 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/ */
arashabedii / telebot example snippets
$host='http://localhost:8005'; //PUT YOUR IP OR DOMAIN ADDRESS HERE. EXAMPLE: http://192.168.1.15
$botUrl=$host.''; //PUT BOT ROOT PATH HERE. EXAMPLE: $botUrl=$host.'/TeleBotDir';
return [
'token'=>'BOT_TOKEN', //PUT YOUR BOT TOKEN HERE
'ADMIN_CHAT_ID'=>'CHAT_ID', //PUT YOUR CHAT_ID HERE
'host'=>$host,
'bot_url'=>$botUrl,
'request_handler_path'=>$botUrl.'/requestsHandler.php',
'bot_main_path'=>$botUrl.'/bootstrap/bot.php',
'DB_CONNECTION'=>'mysql', //or sqlite
'DB_HOST'=>'localhost',
'DB_NAME'=>'telebot', //database name
'DB_USERNAME'=>'root', //database username
'DB_PASSWORD'=>'', //database password
'DB_CHARSET'=>'utf8',
'DB_COLLATION'=>'utf8_unicode_ci',
'APP_BASE_PATH'=>dirname(__DIR__),
];
namespace App\Controllers;
use Src\Message;
class MessageHandler {
public function run(){
bot()->sendMessage(['text'=>$this->getText()]); //insert this code
}
}
php artisan set:webhook
YOUR_DOMAIN/webhookHandler.php?set=1
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.