Download the PHP package eseytgbot/telegram-api without Composer
On this page you can find all versions of the php package eseytgbot/telegram-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download eseytgbot/telegram-api
More information about eseytgbot/telegram-api
Files in eseytgbot/telegram-api
Package telegram-api
Short Description A lightweight and flexible framework for building Telegram bots in PHP.
License MIT
Informations about the package telegram-api
Bot Structure Project
English
A PHP-based Telegram bot framework with a modular command structure.
Project Structure
Setup
- Make sure you have PHP 8 or higher installed
- Configure your Telegram bot token
- Set up your webhook to point to
bot.php
Configuration Structure
The config.php file contains all the configuration settings:
Adding Commands
Place your command App in the App/Commands/BotCommands/ directory.
Each command should be in its own PHP file with the same name as the class.
Helper Utility
The helper utility provides several commands to manage your bot:
| Command | Description |
|---|---|
helper table:up |
Create all database tables |
helper table:fresh |
Drop and recreate all tables |
helper make:command {name} |
Create a new bot command class |
helper delete:command {name} |
Delete a bot command class |
helper make:table {name} |
Create a new database table class |
helper delete:table {name} |
Delete a database table class |
helper webhook:set |
Set the webhook URL for the bot |
helper webhook:delete |
Delete the webhook URL for the bot |
Examples:
Database Management
Schema Usage
The Schema class provides fluent methods for database operations:
Creating Tables
Use CreateTable class to define database structures:
Available Column Types:
int(name, [length])varchar(name, length)text(name)datetime(name)
Column Modifiers:
primaryKey()autoIncrement()notNull()nullable()unique()default(value)index()foreignKey(table, column)
Error Handling
Errors are logged to error.log file. Debug mode can be enabled by changing
display_errors in bot.php.