Download the PHP package unreal4u/telegram-api without Composer

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

PHP 7 Telegram Bot API Library

Telegram API Library

Latest Stable Version Total Downloads Build Status Scrutinizer Code Quality Code Coverage License

This is a PHP7 bot API implementation for Telegram implementing the vast majority of Bot API up until v4.7. The only thing it does not implement is Telegram Passport which was introduced in Bot API v4.0. It is unlikely to be introduced as it may introduce security vulnerabilities. However, if you think you have a strong case for the need, feel free to let me know.

About this package

Known bugs

Telegram

The only thing that is not included in this library (yet) is the Passport support. This was an ongoing development, but it ended up being a lot more work than initially thought, so if someone wants to pick that up... be my guest!

All other known bugs can be found in the form of issues or pull requests. Found a new bug? Feel free to submit a PR or create an issue! Not sure if you've found a new bug? You can always ask in the special group :)

Roadmap

Installation

Total Downloads

Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you. Read this for installation instructions.
The preferred (and only for now) installation method is Composer, so add the following to your composer.json:

If you are not familiar with it, I suggest reading the basic usage manual located here.

Tip for Russian users

In order to use a proxy, you can use the https://github.com/clue/php-socks-react package and pass on the following options to the Client:

With these simple steps, a proxy is configured in no time!

Upgrading v2.x to v3

A lot of backwards incompatibility changes, but in a nutshell:

Please check the following Wiki page if you have to upgrade from v2 to v3.

General usage

Basic usage example:

(Side note: In case React\EventLoop\Factory cannot be resolved in the above code, add include('vendor/autoload.php') to your PHP file).

With the SendMessage() object, you can create a message to be sent through the TgLog object.
All other functionality is based upon this behaviour, so every other method is very similar: you instantiate an object, pass that object to TelegramLog->performApiRequest(), which will return a Promise. If the method returns a reply, pass a callback to its onFulfilled parameter and you'll get the native Telegram response back as an object. Different methods return different object types.

Please refer to the examples directory to view examples of some of the implemented methods, including inline bots.

For examples of actual code that works in a production environment, please refer to my other repo: https://github.com/unreal4u/telegram-bots

Getting updates via Webhook

Please check the following wiki section for more information on this.

Inline bots

Please checkout the special wiki page about inline bots.

Extra requirements

If you want to use this package, you'll need a bot API key. Check the following documentation for more instructions on that.

Getting everything started up

The most difficult thing to do when performing an action with the Telegram API is to get the chat_id, which is the actual conversation window the bot talks to. You can execute the GetUpdates() method in order to get this chatId. Note that there are some caveats on this, so you may be better out with the SetWebhook() method instead.

Development

Semver

I will try my best to respect Semantic Versioning.
That being said, the first stable release is v1.0.0, from there on no mayor BC changes will occur unless we update the major.

Want to colaborate?

Collaborations are very welcome! Check this Wiki page out for more information that will make the development easier!

Contact the author

Telegram

I actually don't use Telegram. Nah, kidding, I created a group where you can contact me at https://t.me/PHPBotAPI. Another great way to get in touch is to simply create an issue or a pull request!

Bugs related with security

I would appreciate it if you could handle these responsibly. If you happen to find a security issue relating to this Telegram Bot API client, please ask me to contact you privately over here.

Special thanks to


All versions of telegram-api with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
ext-json Version *
unreal4u/dummy-logger Version ^1.0
react/promise Version ^2.7
clue/block-react Version ^1.3
yoshi2889/multipart-builder Version ^0.1.1
amphp/artax Version ^3
react/http Version ^1.1
lucadevelop/telegram-entities-decoder Version ^1.2.1
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 unreal4u/telegram-api contains the following files

Loading the files please wait ....