Download the PHP package kyle2142/phpbot without Composer

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

PHPBot

At some point I decided I wanted to make a Telegram bot. I saw the API and thought

hey, I might as well make my own lib for this

This lib doesn't have any groundbreaking features, but it allowed me to develop my own bots and be able to edit the underlying code as I needed.

Please read the wiki!

Getting Started

Prerequisites

Installing

You may use any of the following:

with both of the composer methods, add this to your main file:

Usage

Receiving updates

I highly suggest you set up a webhook (requires SSL), so you can use this amazingly simple code to process updates:

Calling methods

This library contains some convenience functions, as well as access to the normal botAPI functions.

For the most part, you can refer to Telegram's BotAPI for method names and parameters.

If you really want to, you can use PHP's ... operator with convenience functions to unpack arrays:

Check the examples and documentation of the PHPBot class for details

Return values

Success

While calling any raw API method or convenience function, you will get a result in the form of an object or a boolean:

View dump

This means you can access return values as such:

Error

In the case of an error, kyle2142\TelegramException (or one of its subclasses) will be thrown.

As an example, let us try delete a message that does not exist:

(Note that we already deleted message 172 here, so trying to delete it again will throw an error)

When you catch the error, you can get the error code and description (returned by Telegram) as such:

If your bot makes a lot of requests, you might run into 429 "FloodWait" errors, which will tell you how long until you can make that request again:

Have Questions?

Please do not open an issue for small questions etc, it's there for issues

Contributing

If you want to contribute, please make sure you follow the current style and the changes do not break anything!

Tests

To run tests, you need to rename/copy tests/example-config.php to tests/config.php and update the values.

Make sure to have the correct testing environment!

E.g.GROUP_WITH_ADMIN needs to be the ID of a group where the bot is an admin, or skip the tests that require them.

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments


All versions of phpbot with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0
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 kyle2142/phpbot contains the following files

Loading the files please wait ....