Download the PHP package parsapoorsh/telegrambotphp without Composer

On this page you can find all versions of the php package parsapoorsh/telegrambotphp. 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 telegrambotphp

TelegramBotPHP

API PHP CURL

Total Downloads License StyleCI

A very simple PHP Telegram Bot API.
Compliant with the April 21, 2023 Telegram Bot API update.

Requirements

For the WebHook:

For the getUpdates(Long Polling):

Download

Using Composer

From your project directory, run:

or

Note: If you don't have Composer you can download it HERE.

Using release archives

https://github.com/parsapoorsh/TelegramBotPHP/releases

Using Git

From a project directory, run:

Installation

Via Composer's autoloader

After downloading by using Composer, you can include Composer's autoloader:

Via TelegramBotPHP class

Copy Telegram.php into your server and include it in your new bot script:

Note: To enable error log file, also copy TelegramErrorLogger.php in the same directory of Telegram.php file.

Configuration (WebHook)

Navigate to https://api.telegram.org/bot(BOT_TOKEN)/setWebhook?url=https://yoursite.com/your_update.php Or use the Telegram class setWebhook method.

Examples

If you want to get some specific parameter from the Telegram response:

To upload a Photo or some other files, you need to load it with CurlFile:

To download a file on the Telegram's servers

See update.php or update cowsay.php for the complete example. If you want to see the CowSay Bot in action add it.

If you want to use getUpdates instead of the WebHook you need to call the serveUpdate function inside a for cycle.

See getUpdates.php for the complete example.

Functions

Build keyboards

Telegram's bots can have two different kind of keyboards: Inline and Reply.
The InlineKeyboard is linked to a particular message, while the ReplyKeyboard is linked to the whole chat.
They are both an array of array of buttons, which represent the rows and columns.
For instance, you can arrange a ReplyKeyboard like this: ReplyKeyboardExample using this code:

When a user click on the button, the button text is send back to the bot.
For an InlineKeyboard it's pretty much the same (but you need to provide a valid URL or a Callback data) InlineKeyboardExample

This is the list of all the helper functions to make keyboards easily:

Send a custom keyboard. $option is an array of array KeyboardButton.
Check ReplyKeyBoardMarkUp for more info.

Send a custom keyboard. $inline_keyboard is an array of array InlineKeyboardButton.
Check InlineKeyboardMarkup for more info.

Create an InlineKeyboardButton.
Check InlineKeyBoardButton for more info.

Create a KeyboardButton.
Check KeyBoardButton for more info.

Hide a custom keyboard.
Check ReplyKeyBoarHide for more info.

Show a Reply interface to the user.
Check ForceReply for more info.

Emoticons

For a list of emoticons to use in your bot messages, please refer to the column Bytes of this table: http://apps.timwhitlock.info/emoji/tables/unicode

License

This open-source software is distributed under the MIT License. See LICENSE.md

Contributing

All kinds of contributions are welcome - code, tests, documentation, bug reports, new features, etc...

About fork

This repo is based on Eleirbag89/TelegramBotPHP. I forked it because the main repo hadn't been updated for 10 months while Telegram Bot API had 8 updates during that time.

Contact me

You can contact me via Telegram but if you have an issue please open one.


All versions of telegrambotphp with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-json Version *
ext-curl 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 parsapoorsh/telegrambotphp contains the following files

Loading the files please wait ....