Download the PHP package grayhoax/phptelebot without Composer

On this page you can find all versions of the php package grayhoax/phptelebot. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phptelebot

PHPTelebot

Telegram bot framework written in PHP

Version 2.0 - Now with full support for Telegram Bot API 9.2 (2025)

Features

Requirements

Installation

Using Composer

To install PHPTelebot with Composer, just add the following to your composer.json file:

or by running the following command:

Composer installs autoloader at ./vendor/autoloader.php. to include the library in your script, add:

Install from source

Download the PHP library from Github, then include PHPTelebot.php in your script:

Usage

Creating a simple bot

Then run

You can also see my other sample.

NOTE:

Commands

Use $bot->cmd(<command>, <function>) to handle command.

Use * to catch any command.

File upload

This code will send a photo to users when type command /upload.

Events

Use $bot->on(<event>, <function>) to handle all possible PHPTelebot events.

To handle inline message, just add:

Also, you can catch multiple events:

Supported events:

Media Events

Location & Contact

Service Messages

Forum Events

Video Chat Events

Inline & Callback

Business Account Events (2024-2025)

Reactions & Boosts

Member & Chat Updates

Payments

Other

Command with custom regex (advanced)

Create a command: /regex string number

Methods

PHPTelebot Methods

cmd(<command>, <answer>)

Handle a command.

on(<event>, <answer>)

Handles events.

regex(<regex>, <answer>)

Create custom regex for command.

Bot::type()

Return message event type.

Bot::message()

Get message properties.

Telegram Methods

PHPTelebot uses standard Telegram Bot API method names. All methods support the same parameters as documented in the official API.

Sending Messages & Media

Bot::getMe() ?

A simple method for testing your bot's auth token.

Bot::sendMessage(<text>, <options>) ?

Use this method to send text messages.

Bot::forwardMessage(<options>) ?

Use this method to forward messages of any kind.

Bot::copyMessage(<chat_id>, <options>) ?

Use this method to copy messages of any kind.

Bot::sendPhoto(<file path | file id | url>, <options>) ?

Use this method to send a photo.

Bot::sendVideo(<file path | file id | url>, <options>) ?

Use this method to send a video.

Bot::sendAnimation(<file path | file id | url>, <options>) ?

Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).

Bot::sendVideoNote(<file path | file id | url>, <options>) ?

Use this method to send video messages (rounded square mp4 videos).

Bot::sendAudio(<file path | file id | url>, <options>) ?

Use this method to send audio files.

Bot::sendVoice(<file path | file id | url>, <options>) ?

Use this method to send voice messages.

Bot::sendDocument(<file path | file id | url>, <options>) ?

Use this method to send documents.

Bot::sendSticker(<file path | file id | url>, <options>) ?

Use this method to send stickers.

Bot::sendMediaGroup(<media>, <options>) ?

Use this method to send a group of photos, videos, documents or audios as an album.

Bot::sendPoll(<question>, <options>) ?

Use this method to send a native poll. Supports up to 12 options.

Bot::sendDice(<emoji>, <options>) ?

Use this method to send an animated emoji (dice, darts, basketball, etc.).

Bot::sendLocation(<options>) ?

Use this method to send point on the map.

Bot::sendVenue(<options>) ?

Use this method to send information about a venue.

Bot::sendContact(<options>) ?

Use this method to send phone contacts.

Bot::sendChatAction(<action>, <options>) ?

Use this method when you need to tell the user that something is happening on the bot's side.

Bot::deleteMessage(<chat_id>, <options>) ?

Use this method to delete a message.

Bot::deleteMessages(<options>) ?

Use this method to delete multiple messages simultaneously.

Bot::getUserProfilePhotos(<user id>, <options>) ?

Use this method to get a list of profile pictures for a user.

Bot::getFile(<file id>) ?

Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size.

Bot::answerInlineQuery(<array of results>, <options>) ?

Use this method to send answers to an inline query.

Bot::answerCallbackQuery(<text>, <options>) ?

Use this method to send answers to callback queries sent from inline keyboards.

Bot::getChat(<chat_id>) ?

Use this method to get up to date information about the chat.

Bot::leaveChat(<chat_id>) ?

Use this method for your bot to leave a group, supergroup or channel.

Bot::setChatPhoto(<photo>, <options>) ?

Use this method to set a new profile photo for the chat.

Bot::deleteChatPhoto(<chat_id>) ?

Use this method to delete a chat photo.

Bot::setChatTitle(<chat_id>, <options>) ?

Use this method to change the title of a chat.

Bot::setChatDescription(<chat_id>, <options>) ?

Use this method to change the description of a group, supergroup or channel.

Bot::pinChatMessage(<message_id>, <options>) ?

Use this method to add a message to the list of pinned messages in a chat.

Bot::unpinChatMessage(<chat_id>, <options>) ?

Use this method to remove a message from the list of pinned messages in a chat.

Bot::unpinAllChatMessages(<options>) ?

Use this method to clear the list of pinned messages in a chat.

Bot::getChatAdministrators(<chat_id>) ?

Use this method to get a list of administrators in a chat.

Bot::getChatMemberCount(<chat_id>) ?

Use this method to get the number of members in a chat.

Bot::getChatMember(<options>) ?

Use this method to get information about a member of a chat.

Bot::banChatMember(<chat_id>, <options>) ?

Use this method to ban a user from a group, supergroup or channel.

Bot::unbanChatMember(<options>) ?

Use this method to unban a previously banned user in a supergroup or channel.

Bot::restrictChatMember(<chat_id>, <options>) ?

Use this method to restrict a user in a supergroup.

Bot::promoteChatMember(<chat_id>, <options>) ?

Use this method to promote or demote a user in a supergroup or a channel.

Bot::setChatAdministratorCustomTitle(<chat_id>, <options>) ?

Use this method to set a custom title for an administrator.

Bot::banChatSenderChat(<chat_id>, <options>) ?

Use this method to ban a channel chat in a supergroup or a channel.

Bot::unbanChatSenderChat(<chat_id>, <options>) ?

Use this method to unban a previously banned channel chat.

Bot::setChatPermissions(<options>) ?

Use this method to set default chat permissions for all members.

Bot::exportChatInviteLink(<chat_id>) ?

Use this method to generate a new primary invite link for a chat.

Bot::createChatInviteLink(<options>) ?

Use this method to create an additional invite link for a chat.

Bot::editChatInviteLink(<options>) ?

Use this method to edit a non-primary invite link.

Bot::revokeChatInviteLink(<options>) ?

Use this method to revoke an invite link.

Bot::approveChatJoinRequest(<chat_id>, <options>) ?

Use this method to approve a chat join request.

Bot::declineChatJoinRequest(<chat_id>, <options>) ?

Use this method to decline a chat join request.

Forum Topics

Bot::createForumTopic(<chat_id>, <options>) ?

Use this method to create a topic in a forum supergroup chat.

Bot::editForumTopic(<chat_id>, <options>) ?

Use this method to edit name and icon of a topic.

Bot::closeForumTopic(<chat_id>, <options>) ?

Use this method to close an open topic in a forum supergroup chat.

Bot::reopenForumTopic(<chat_id>, <options>) ?

Use this method to reopen a closed topic in a forum supergroup chat.

Bot::deleteForumTopic(<chat_id>, <options>) ?

Use this method to delete a forum topic.

Bot::unpinAllForumTopicMessages(<chat_id>, <options>) ?

Use this method to clear the list of pinned messages in a forum topic.

Bot::editGeneralForumTopic(<options>) ?

Use this method to edit the name of the 'General' topic.

Bot::closeGeneralForumTopic(<options>) ?

Use this method to close the 'General' topic in a forum supergroup chat.

Bot::reopenGeneralForumTopic(<options>) ?

Use this method to reopen the 'General' topic in a forum supergroup chat.

Bot::hideGeneralForumTopic(<options>) ?

Use this method to hide the 'General' topic in a forum supergroup chat.

Bot::unhideGeneralForumTopic(<options>) ?

Use this method to unhide the 'General' topic in a forum supergroup chat.

Bot::getForumTopicIconStickers() ?

Use this method to get custom emoji stickers for use as forum topic icons.

Reactions & Boosts

Bot::setMessageReaction(<chat_id>, <options>) ?

Use this method to change the chosen reactions on a message.

Bot::getUserChatBoosts(<chat_id>, <options>) ?

Use this method to get the list of boosts added to a chat by a user.

Games

Bot::sendGame(<game short name>, <options>) ?

Use this method to send a game.

Bot::setGameScore(<options>) ?

Use this method to set the score of the specified user in a game.

Bot::getGameHighScores(<user id>, <options>) ?

Use this method to get data for high score tables.

Stickers

Bot::uploadStickerFile(<user_id>, <options>) ?

Use this method to upload a file with a sticker.

Bot::createNewStickerSet(<options>) ?

Use this method to create a new sticker set.

Bot::addStickerToSet(<options>) ?

Use this method to add a new sticker to a set.

Bot::deleteStickerFromSet(<options>) ?

Use this method to delete a sticker from a set.

Bot::getStickerSet(<name>) ?

Use this method to get a sticker set.

Bot::deleteStickerSet(<name>) ?

Use this method to delete a sticker set.

Bot::getCustomEmojiStickers(<custom_emoji_ids>) ?

Use this method to get information about custom emoji stickers.

Payments & Stars

Bot::getMyStarBalance() ?

Use this method to get the bot's current balance of Telegram Stars.

Bot::getStarTransactions(<options>) ?

Use this method to get the list of bot's Star transactions.

Bot::refundStarPayment(<options>) ?

Use this method to refund a successful Star payment.

Bot::createInvoiceLink(<title>, <options>) ?

Use this method to create a link for an invoice.

Bot::answerShippingQuery(<shipping_query_id>, <options>) ?

Use this method to reply to shipping queries.

Bot::answerPreCheckoutQuery(<pre_checkout_query_id>, <options>) ?

Use this method to respond to pre-checkout queries.

Bot Configuration

Bot::getMyCommands(<options>) ?

Use this method to get the current list of the bot's commands.

Bot::setMyCommands(<options>) ?

Use this method to change the list of the bot's commands.

Bot::deleteMyCommands(<options>) ?

Use this method to delete the list of the bot's commands.

Business Account Management

Bot::getBusinessConnection(<business_connection_id>) ?

Use this method to get information about the connection with a business account.

Bot::setBusinessAccountName(<name>, <options>) ?

Use this method to change the name of a business account.

Bot::setBusinessAccountUsername(<username>, <options>) ?

Use this method to change the username of a business account.

For a complete list of all 100+ supported methods, see official Telegram Bot API documentation.

Webhook installation

Open via browser https://api.telegram.org/bot<BOT TOKEN>/setWebhook?url=https://yourdomain.com/your_bot.php


All versions of phptelebot with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
ext-curl Version *
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package grayhoax/phptelebot contains the following files

Loading the files please wait ...