Skip to content

Create powerful app integrations with this Telegram Bot SDK. It's as easy as incredible!!

License

Notifications You must be signed in to change notification settings

tiagosampaio/telegram-bot-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telegram Bot PHP

The easiest way to integrate your PHP application with Telegram Bots.

Create powerful app integrations with this Telegram Bot SDK. It's as easy as incredible!!

See an example of how easy it is to use:

<?php
    /**
     * Inject the composer's autoload file.
     */
    require_once __DIR__ . '/vendor/autoload.php';

    /**
     * Assuming you already have the token created using the BotFather.
     */
    $token = '[SOME TOKEN HASH]';
    
    /**
     * And that you have the chat ID too, you can simply define the text you'd like to send, for instance.
     */
    $chatId = [SOME CHAT ID];
    $text   = \Faker\Factory::create()->sentence(20);

    /**
     * Create and instance of the API by using the ApiFactory.
     * @var \Telegram\ApiInterface $api
     */
    $api = \Telegram\ApiFactory::create($token);
    
    /**
     * And call the proper method.
     * @var \Telegram\Service\ResultInterface $response
     */
    $response = $api->methods()->sendMessage($chatId, $text);

Telegram BotFather

This link to BotFather will guide you to create your Telegram Bot.

Authors

Tiago Sampaio - tiago@tiagosampaio.com

License

Telegram Bot PHP is a personal project initiated in late 2018 by Tiago Sampaio. It's free for use.

The Open Software License 3.0 (OSL-3.0).

Pelase, see the file LICENSE.txt to a complete description of the OSL License.