PHP code example of mnlnk / telegram-bot-api

1. Go to this page and download the library: Download mnlnk/telegram-bot-api 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/ */

    

mnlnk / telegram-bot-api example snippets


use Manuylenko\Telegram\Bot\Api\Api;
use Manuylenko\Telegram\Bot\Api\Entities\InputFile;


// ..

$token = '0123456789:AAFYmpDWKXs_qc-2Let7p2VaHIC-cLrXLtE';

$api = new Api($token);

// Отправка текстового сообщения
$api->sendMessage('@channelname', 'Привет, мир!');

// Отправка видео
$api->sendVideo('@channelname', 'https://veshok.com/dw/load.php?id=37188');

// Отправка документа 
$api->sendDocument('@channelname', InputFile::make('C:\Some\File.zip'));