Download the PHP package mjm/telegram-cli-client without Composer

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

Update 2015-12-23:

As i currently have no time to work on this project anymore and telegram released its own bot-api, there won't be many new updates to this project in the future. I will try to go through all currently open issues so there is nothing left in the issue section anymore (even if i need to close some things with wontfix).
If someone wants to takeover this project i am willing to give him push-rights or link to his fork on github/packagist.

If you want to port your project to the new bot-api take a look at the unofficial php-sdk.


mjm/telegram-cli-client

php-client for telegram-cli

Packagist Codacy License

Requirements

Usage

Setup telegram-cli

telegram-cli needs to run on a unix-socket (-S) or a port (-P), so telegram-cli-client can connect to it. All answers need to be returned as JSON (--json).
You should also start it with -W so the contact-list gets loaded on startup.
For this example we will take the following command (execute it from the dir, where you installed telegram-cli, not the php-client), -d lets it run as daemon.:

If you run the telegram-cli under another user than your php-script and you are using linux, you need to change the rights of the socket so that the php-script can access it (thanks to dennydai for this!).
For example, add both to a telegram-group and then do

If you never started telegram-cli before, you need to start it first in normal mode, so you can type in your telegram-phone-number and register it, if needed (./bin/telegram-cli).

To stop the daemon use killall telegram-cli or kill -TERM [telegram-pid].

Install telegram-cli-client with composer

In your project-root:

Composer will then automatically add the package to your project requirements and install it (also creates the composer.json if you don't have one already).
If you want to use the discovery-shell, remove the --update-no-dev from the command.

Use it

Use it with the discovery-shell

A really easy way to learn the api is by using the embedded discover-shell. You need to install the dev-dependencies for this (composer update --dev).

Documentation

To create the docs, just run phpdoc in the the project-root.
An online-version is available at phpdoc.zyberware.org/zyberspace/telegram-cli-client.

Supported Commands

You can execute every command with the exec()-method from the RawClient-class, but there are also several command-wrappers available (doc-link) that you should prefer to use (see the example.php).
If you prefer to only use your own command-wrappers instead, just extend the RawClient-class (takes care about the socket-connection and has some helper-methods).

In your command-wrappers or if you use exec() directly, please don't forget to escape the peers (contacts, chat-names, etc.) with escapePeer() and all string-arguments with escapeStringArgument() to avoid errors.

API-Stability

The api of the commands wrappers will definitely change in the future, for example getHistory() only returns the raw answer of the telegram-cli right now and is not really useful. Therefore you should not use this in production yet.

*If you still want to use this in your project, make sure you stay at the same minor-version (~0.1.0 or `0.1.` for example)**.

License

This software is licensed under the Mozilla Public License v. 2.0. For more information, read the file LICENSE.


All versions of telegram-cli-client with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0,<6.0.0
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 mjm/telegram-cli-client contains the following files

Loading the files please wait ....