Recommend this page to a friend! |
Download .zip |
Info | Demos | View files (54) | Download .zip | Reputation | Support forum (1) | Blog (2) | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not enough user ratings | Total: 797 | All time: 4,273 This week: 204 |
Version | License | PHP version | Categories | |||
telegram-cli-wrapper 1.0.3 | MIT/X Consortium ... | 5.3 | PHP 5, Unix, Chat |
Description | Author | |||
This class can send messages and other commands to Telegram users. Innovation Award
|
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.
./bin/telegram-cli
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) https://github.com/vysheng/tg/wiki/Running-Telegram-CLI-as-Daemon
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.
##Examples
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.
##Last thoughts
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.
Files | / | public |
File | Role | Description | ||
---|---|---|---|---|
css (1 file) | ||||
img (3 files) | ||||
js (2 files) | ||||
area.php | Example | Example script | ||
check.php | Example | Example script | ||
favicon.ico | Data | Auxiliary data | ||
index.php | Example | Example script | ||
login.php | Example | Example script | ||
messages.php | Example | Example script | ||
profile.php | Example | Example script | ||
register.php | Example | Example script | ||
send.php | Example | Example script |
Files | / | public | / | img |
File | Role | Description |
---|---|---|
ajax-loader.gif | Data | Auxiliary data |
telegram-lo.png | Icon | Icon image |
telegram.png | Data | Auxiliary data |
Files | / | public | / | js |
File | Role | Description |
---|---|---|
common.js | Data | Auxiliary data |
ie10-viewport-bug-workaround.js | Data | Auxiliary data |
Files | / | src |
File | Role | Description | ||
---|---|---|---|---|
Models (4 files) | ||||
Services (3 directories) | ||||
Storage (2 files) | ||||
Config.php | Class | Class source | ||
Response.php | Class | Class source | ||
TelegramCliHelper.php | Class | Class source | ||
TelegramCliWrapper.php | Class | Class source |
Files | / | src | / | Models |
File | Role | Description |
---|---|---|
BasicObject.php | Class | Class source |
Dialog.php | Class | Class source |
Flags.php | Class | Class source |
User.php | Class | Class source |
Files | / | src | / | Services | / | Media |
File | Role | Description | ||
---|---|---|---|---|
images (15 files) | ||||
MediaSelector.php | Class | Class source |
Files | / | src | / | Services | / | Media | / | images |
File | Role | Description |
---|---|---|
0.jpg | Icon | Icon image |
1.jpg | Icon | Icon image |
10.jpg | Icon | Icon image |
11.jpg | Icon | Icon image |
12.jpg | Icon | Icon image |
13.jpg | Icon | Icon image |
14.jpg | Icon | Icon image |
2.jpg | Icon | Icon image |
3.jpg | Icon | Icon image |
4.jpg | Icon | Icon image |
5.jpg | Icon | Icon image |
6.jpg | Icon | Icon image |
7.jpg | Icon | Icon image |
8.jpg | Icon | Icon image |
9.jpg | Icon | Icon image |
Files | / | src | / | Storage |
File | Role | Description |
---|---|---|
LocalFilesStorage.php | Class | Class source |
StorageInterface.php | Class | Class source |
Files | / | test |
File | Role | Description |
---|---|---|
addContact.php | Example | Example script |
myChatWith.php | Example | Example script |
myContacts.php | Example | Example script |
myDialogs.php | Example | Example script |
server-sample.php | Example | Example script |
userInfo.php | Example | Example script |
whoAmI.php | Example | Example script |
telegram-cli-wrapper-2018-11-15.zip 1130KB | |
telegram-cli-wrapper-2018-11-15.tar.gz 1124KB | |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
User Comments (1) | |||||
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.