|Last Updated|| ||Ratings|| ||Unique User Downloads|| ||Download Rankings|
|2018-11-15 (1 year ago) ||Not enough user ratings||Total: 763 ||All time: 4,358 This week: 274|
This class can send messages and other commands to Telegram users.
It connects to the telegram CLI program via local Unix domain sockets.
The class can send many other types of command. Currently it can:
- Change the status to online or offline
- Get the contact list
- Send typing status
- Send a message to a peer
- Delete contact
- Delete user from chat
- Mark messages as read
- Get the dialog list
- Get a peer chat information
- Get user information
- Block or unblock_user
- Broadcast message
- Create group chat
- Set profile name
- Add contact
- Add user to chat
- Rename contact
- Get chat history
Prize: One book of choice by Packt
|Telegram is a popular application for exchanging messages between users in an encrypted format.
This class can send messages and interaction with Telegram chat users using the Telegram CLI application.
Follow the instructions for your operating system.
You need to start the telegram-cli the first time manually in order to register the phone number.
After that, start telegram-cli as a daemon from the root of the tg repo.
./bin/telegram-cli --json -dWS /tmp/tg.sck &
You can try to use that one to install telegram-cli as a daemon in your server (I was unable to do)
Basically you have to create a group telegram and add users www-data (or apache), root (or the user you use to access through ssh) and telegramd.
give permissions to /tmp/tg.sck to that group (telegram)
You can start telegram-cli manually following the above order or just let the script to start it.
Once installed vysheng/tg clone this project with:
Run ```composer install``` inside the folder repo in order to create autoload files.
Take a look on test folder to see how easy is to use the wrapper.
If you don't want to have started telegram-cli you can use TelegramCliHelper in order to start it automatically each time
is needed. To do that you need to create a config.ini in the config folder (you have config.ini.dis as a template)
All the examples in the test folder use this Helper.
##Why TelegramCliHelper and Why to use it ?
The better way to use telegram-cli IMHO is to have started always the telegram-cli as a daemon. But maybe you want to
test something or only start it when you really need it. Becase you use a lazy cron that checks for chats once per hour or
something like that. In a real environment I would prefer to have started telegram-cli and a php script checking in loop
all chats in order to serve to users in real time.
In order that you know how to use the automated system to accept "orders" from the users or notify them by Telegram
I have prepared a little web application that you can find in /public folder.
Remember that some "orders" need defailed configuration in /config/config.ini, openweathermap is one of them. You can
create a free account. The weather is cached in order that don't exceed the number of free calls.
Obviously all of this is only a big example, a proof of concept if you want.
You have to create the services that your web need and provide access to your users in the way you consider the better.
In order to simplify at maximum the examples I have created a simpleStorage system for users that come to the web, on the
/data/user folder the users are serialized and labeled with the phone number. In your definitive system you have to connect
your real users with the phone number, probably with a mysql table or something like that.
Any pull request or issue with improvement proposal are welcome.
||Applications that use this package
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.