tiagosampaio/telegram-bot-php

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

dev-master 2019-06-19 19:34 UTC

This package is auto-updated.

Last update: 2024-10-20 07:28:06 UTC


README

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.