PHP Telegram Bot based on the official Telegram Bot API

Last update: Dec 8, 2021

PHP Telgram Bot API

PHP wrapper for Telegram's Bot API.

Minimal PHP version Build Status

Installation

Add this line to your application's composer.json:

{
    "require": {
        "stajor/telegram-bot": "^3.0"
    }
}

and run composer update

Or run this command in your command line:

$ composer require stajor/telegram-bot

Telegram API support

All types and methods of the Telegram Bot API 3.6 are supported.

Configuration

First of all you need create your own bot and obtain a token

How do I create a bot?

Usage

You can use Telegram::Bot::Api standalone



$api = new \Telegram\Bot\Api('BOT TOKEN');
$user = $api->getMe();

Or by using CommandsHandler to receive updates from Telegram

Create command class

replyWithMessage(['text' => 'Welcome to my Bot']); // Trigger another command dynamically from within this command $this->triggerCommand('help'); } }">


use Telegram\Bot\Command;

class StartCommand extends Command {
    /**
     * @var string Command Name
     */
    protected $name = "start";

    /**
     * @var string Command Description
     */
    protected $description = "Start Command to get you started";

    /**
     * @inheritdoc
     */
    public function handle() {
        // This will send a message using `sendMessage`
        $this->replyWithMessage(['text' => 'Welcome to my Bot']);
        
        // Trigger another command dynamically from within this command
        $this->triggerCommand('help');
    }
}

In your controller add


       
$handler = new CommandsHandler('BOT TOKEN');
$handler->addCommand(StartCommand::class);
$handler->handle();

Send Photo

$api = new \Telegram\Bot\Api('BOT TOKEN');
$api->sendPhoto(['chat_id' => 123,'photo' => fopen('path_to_photo', 'rb')]);

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Stajor/telegram-bot. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

GitHub

https://github.com/Stajor/telegram-bot
You might also like...

Fluent Keyboard builder for php-telegram-bot.

Fluent Keyboard builder for php-telegram-bot.

Table of Contents Installation Usage Defining a Keyboard Defining Buttons Bind Buttons to a Keyboard By Row By Button As Stack ForceReply and ReplyKey

Apr 12, 2022

Robot increase telegram post πŸ‘β€πŸ—¨Telegram Fake Posts ViewerπŸ‘β€πŸ—¨

Robot increase telegram post πŸ‘β€πŸ—¨Telegram Fake Posts ViewerπŸ‘β€πŸ—¨

Program Features - πŸ“ Very and stylish design. - πŸ“ It has glass buttons. - πŸ“ Has a professional management panel. - πŸ“ Has a user area. - πŸ“ Free di

May 30, 2022

A tool for sending fast and managed messages to Telegram bot users

πŸ‘‹πŸ» HiToAll A tool for sending fast and managed messages to Telegram bot users About In some telegram bots programmed with php language, if there are

Oct 3, 2021

telegram bot for sell virtual number

Telefake Telegram bot for sell virtual number (fully automatic) Installation create bot in telegram upload script in website with php and ssl (https)

Oct 19, 2021

laravel package untuk memudahkan penggunaan MCA dengan Telegram Bot USDI di aplikasi Universitas Udayana.

MCA KubeMQ Laravel laravel package untuk memudahkan penggunaan MCA dengan Telegram Bot USDI di aplikasi Universitas Udayana. Motivasi Proyek ini berfu

Nov 17, 2021

Telegram bot for CC Checker with hella lotta features.

 Telegram bot for CC Checker with hella lotta features.

SDMN CHECKER BOT Telegram bot for CC Checker with hella lotta features. πŸ“ Table of Contents Dependencies / Limitations Future Scope Setting up a Hero

Jul 26, 2022

Create and manage advanced polls with this Telegram Bot which has many features available!

Create and manage advanced polls with this Telegram Bot which has many features available!

MasterPollBot Create and manage advanced polls with this Telegram Bot which has many features available! Requirements Local Telegram Bot API or a webh

Jun 21, 2022

Bin checker telegram bot

Bin checker telegram bot

BIN Checker Bot Test Bot: Bin Checker Bot Env API_TOKEN Bot token. START_MSG Custom start message. Deploy Heroku Railway ⚠ Warn: Still not Tested on R

Mar 6, 2022

This app remembers todo list in every specified time (e. every minute, hour, day etc) through telegram bot

remember_todo_list This app remembers todo list in every specified time (e. every minute, hour, day etc) through telegram bot This project includes tw

Nov 27, 2021
πŸ€– Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
πŸ€– Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.

Telegram Bot API - PHP SDK Telegram Bot PHP SDK lets you develop Telegram Bots in PHP easily! Supports Laravel out of the box. Telegram Bot API is an

Aug 1, 2022
Integrate Your PHP Code With Telegram Bot API for Beginner

Documentation[https://core.telegram.org/bots/api] Resource[https://github.com/bachors/KBBI.sql] Integrate Your PHP Code With Telegram Bot API for Begi

Oct 19, 2021
Easy to install email tracker with gui and telegram api bot with date device & ip tracking,

mail-php-tracking-with-gui ?? Simple mail tracking program that uses php, html, telegram bot, and a gui The gui The gui lets you create specific links

Jul 23, 2022
A telegram bot to check credit cards. written in php & py

MRBANKER BOT A telegram bot to check credit cards. written in php & py. You can find me on telegram STEP1: goto botfather create a bot copy the token

Aug 3, 2022
NovaGram - An elegant, Object-Oriented, reliable PHP Telegram Bot Library
NovaGram - An elegant, Object-Oriented, reliable PHP Telegram Bot Library

An elegant, Object-Oriented, reliable PHP Telegram Bot Library Full Documentation β€’ Public support group Examples β€’ Features β€’ Installation ?

Jul 24, 2022
Simple telegram auto reminder BOT with PHP

Telebot Script Telegram BOT Auto Reminder Dibuat pake PHP OOP Sebenernya bukan buat dipublish sih, ini cuma buat praktek PHP OOP sama praktek Commit &

May 26, 2022
A simple php telegram bot to check if the bin is valid or not!

Bin-Checker A simple php telegram bot to check if the bin is valid or not! Deploy FORK the Repo by clicking HERE Add your bot token in LINE 12 THEN DE

Nov 23, 2021
Simple php telegram bot.
Simple php telegram bot.

PHPTGBot Description Simple php telegram bot. Just for fun ?? Work In Progress ?? Maybe found error, since im not tested yet! Still on working, so be

Nov 24, 2021
PHP Source - Telegram Bot - Standart Method

Telegram Bot- yaratish uchun mo'ljallangan standart metod asosida ishlovchi, PHP tilida yozilgan kod Dasturchilarning eng yaxshi ko'rgan odati c/p bo'

Mar 30, 2022
A Php Checker Bot For Telegram.
A Php Checker Bot For Telegram.

A Card Checker Bot For Telegram Based On Telegram.

Jul 22, 2022