matmper/php-telegram-sdk-bot

The PHP Telegram SDK (BOT) is a easy-to-use package designed to simplify the integration of Telegram bots into PHP applications

1.0.0 2025-02-24 19:55 UTC

This package is auto-updated.

Last update: 2025-04-24 20:23:56 UTC


README

Requirements

- PHP `^8.0`
- cURL Extension

Installation

Install the package via Composer:

$ composer require matmper/php-telegram-sdk-bot

Usage

This package allows you to easily interact with Telegram's Bot API. You can send messages, receive updates, and handle bot interactions with a few lines of code.

Create Telegram BOT: From BotFather to Hello World

Sending a Message

Telegram Doc: sendMessage

require 'vendor/autoload.php';

use Matmper\TelegramBot;
use Matmper\Enum\ParseMode;

$botToken = '12345678:a1b2c3d4f5g6';
$chatID = '-100000000';

$telegram = new TelegramBot($botToken, $chatID);
$telegram->sendMessage('Hello world!');

// Send more optional options in the body of the request
$telegram->sendMessage('<b>Hello world!</b>', ['parse_mode' => ParseMode::HTML->value]);

Contribution & Development

Contributions are welcome! This project is open-source and free for distribution.

Development Setup

Clone the repository and install dependencies:

$ composer install --dev --prefer-dist

Ensure all tests and coding standards are met before submitting a pull request:

$ composer check

All contributions must be submitted via pull requests and must pass tests and coding standards before being merged.