dev-master
9999999-devTelegram Bot API written in PHP
MIT
The Requires
- php >=5.4
- guzzlehttp/guzzle 5.3.0
by Vinay Kumar
api bot telegram telegram-bot
Wallogit.com
2017 © Pedro Peláez
Telegram Bot API written in PHP
Let's you integrate with Telegram Bot API using PHP., (*1)
Step 1: By using Composer, (*2)
$ composer require curiouscoder/telegram-php-bot
or, (*3)
composer.json file, (*4)
{
"require": {
"curiouscoder/telegram-php-bot": "dev-master"
}
}
Step 2: Assuming composer's autoloader is made use of. [require 'vendor/autoload.php';], (*5)
use CuriousCoder\TelegramBot\TelegramBot; use CuriousCoder\TelegramBot\Config\Config;
Step 3: Create new instance of Config class and set your api key. Check botfather to register your app., (*6)
$config = new Config();
$config->setApiKey("Your Key");
Step 4: Create new instance of TelegramBot class and pass your Config class instance, (*7)
$telegram = new TelegramBot($config);
All the methods listed on Telegam Bot API page are fully supported., (*8)
To get info on your Bot, (*9)
print_r($telegram->getMe());
To send a text message, (*10)
$response = $telegram->sendMessage('CHAT_ID','Hello!');
print_r($response);
By default video, audio, sticker and photo formats are preset. You can view or add formats using Config class, (*11)
$config = new Config(); $config->getAudioFormats(); $config->setAudioFormats(['mp3']); $config->getVideoFormats(); $config->setVideoFormats(['avi']); $config->getPhotoFormats(); $config->setPhotoFormats(['png','jpg']);
Thank you for considering contributing to the project., (*12)
This project and its author is neither associated, nor affiliated with Telegram in anyway. See License section for more details., (*13)
Telegram Bot API written in PHP
MIT
api bot telegram telegram-bot