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-04-20 06:27:39 UTC


README

telegram.png

68747470733a2f2f7472617669732d63692e6f72672f746961676f73616d7061696f2f54656c656772616d2d426f742d5048502e7376673f6272616e63683d6d6173746572 68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6632643131646636623038323463623938666264376261633132623631313832 68747470733a2f2f7777772e636f64657472696167652e636f6d2f746961676f73616d7061696f2f74656c656772616d2d626f742d7068702f6261646765732f75736572732e737667 68747470733a2f2f706f7365722e707567782e6f72672f746961676f73616d7061696f2f74656c656772616d2d626f742d7068702f642f746f74616c2e737667 68747470733a2f2f706f7365722e707567782e6f72672f746961676f73616d7061696f2f74656c656772616d2d626f742d7068702f6c6963656e73652e737667 68747470733a2f2f706f7365722e707567782e6f72672f746961676f73616d7061696f2f74656c656772616d2d626f742d7068702f762f737461626c65

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.

botfather.jpg

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.