Download the PHP package s0d3s/tg-long-req without Composer
On this page you can find all versions of the php package s0d3s/tg-long-req. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download s0d3s/tg-long-req
More information about s0d3s/tg-long-req
Files in s0d3s/tg-long-req
Package tg-long-req
Short Description Simple PHP class for navigate user in telegram bot(by design)
License MIT
Homepage https://github.com/irazasyed/telegram-bot-sdk
Informations about the package tg-long-req
TG LONG REQUEST
What is this?
This is a small help-oriented class for creating tg bots. It helps with the creation and navigation in the menu telegram bot
Это небольшой класс для телеграм ботов. Он помогает в создании меню и дальнейшей навигации в нём.
Abstract exemple
INSTALL
via composer
(add this to section "require" in your composer.json)
{
"require" : {
"s0d3s/tg-long-req": ">=1"
}
}
and
include_once('path/to/autoload.php');
use s0d3s\TgLongReq;
manual
Copy the "TgLongReq.php" to the project dir and:
include_once('TgLongReq.php');
use s0d3s\TgLongReq;
Simple use
- Create a TgLongReq obj
$tg_req = TgLongReq ( 'user_id', 'req_func list' /optinal/ , 'user_request_dir', tg_api_key, tg_api_result );
Var Type Caption $user_id STRING Telegram user id $req_func ARRAY Requests and functions association table $usr_req_dir STR Path to general request dir ** $tg_api_key SOMETH/* irazasyed/telegram-bot-sdk Api() object* $tg_api_result SOMETH/* Api()->getWebhookUpdates()
*It could be something else, or be null. **Temporary requests from users will be stored in this folder.
- Create request
$tg_req->reqCreate('req_name'); *
*This parameter depends only on you (this name should be in the association table)
-
Save and restore temprorary data
- saving
For store (temporary) data, you can use "saveToTemp", the function accepts any data types and saves it as json string
$tg_req->saveToTemp(\$some_data);
- restore
.
$some_array = array(); $some_array = \$tg_req->getFromTemp(\$hold_it==false);*
* If needed, you can leave a temporary file until the next used, for this pass to function "true"(bool)
- Check the existence of the request
$tg_req->reqCheck(); //return true if exists, else false
- Delete user request
$tg_req->reqDel();
- Handling request
$tg_req->reqHand(); //This method will call the corresponding function from the association table.
- NOTES
- Association table is array('req_name'=>'func_name')
- Functions specified in the table may not process passed parameters
Some examples you can find at ./exmp