Skip to content
 
 

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telegram Bot API Client

Telegram Bot API Client

Installation

Composer

The preferred way to install this extension is through Composer.

Either run

php composer.phar require "zelenin/telegram-bot-api" "~0.0"

or add

"zelenin/telegram-bot-api": "~0.0"

to the require section of your composer.json

Usage

$client = new Zelenin\Telegram\Bot\Api($token);

try {
    $response = $client->sendMessage([
        'chat_id' => $chatId,
        'text' => 'Test message
    ]);
    print_r($response);
    
    $response = $client->sendPhoto([
    	'chat_id' => $myId,
    	'photo' => fopen('/home/www/photo.jpg', 'r')
    ]);
    print_r($response);
} catch (\Zelenin\Telegram\Bot\NotOkException $e) {
    echo $e->getMessage();
}

See Bot API documentation for other methods.

Author

Aleksandr Zelenin, e-mail: aleksandr@zelenin.me

About

Telegram Bot API Client

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages