![]() |
PhpBotFramework
1.0.0
A framework for Telegram Bots' APIs.
|
Functions | |
| & | DanySpin97\PhpBotFramework\Bot::getLanguageDatabase ($default_language='en') |
| Get current user language from the database, and set it in $language. More... | |
| & | DanySpin97\PhpBotFramework\Bot::getLanguageRedis ($default_language='en') |
| Get current user language from redis, and set it in language. More... | |
| & | DanySpin97\PhpBotFramework\Bot::getLanguageRedisAsCache ($default_language='en', $expiring_time='86400') |
| Get current user language from redis, as a cache, and set it in language. More... | |
| DanySpin97\PhpBotFramework\Bot::setLanguageRedisAsCache ($language, $expiring_time='86400') | |
| Set the current user language in both redis, sql database and $language. More... | |
Variables | |
| DanySpin97\PhpBotFramework\Bot::$language | |
| Store the language for a multi-language bot. | |
| DanySpin97\PhpBotFramework\Bot::$localization | |
| Store the array containing language. | |
| DanySpin97\PhpBotFramework\Bot::$user_table = '"User"' | |
| Table contaning bot users data in the sql database. | |
| DanySpin97\PhpBotFramework\Bot::$id_column = 'chat_id' | |
| Name of the column that represents the user id in the sql database. | |
| & DanySpin97\PhpBotFramework\Bot::getLanguageDatabase | ( | $default_language = 'en' | ) |
Get current user language from the database, and set it in $language.
| $default_language | Optional. Default language to return in case of errors. |
| & DanySpin97\PhpBotFramework\Bot::getLanguageRedis | ( | $default_language = 'en' | ) |
Get current user language from redis, and set it in language.
Using redis database we get language stored and the value does not expires.
| $default_language | Optional. Default language to return in case of errors. |
| & DanySpin97\PhpBotFramework\Bot::getLanguageRedisAsCache | ( | $default_language = 'en', |
|
$expiring_time = '86400' |
|||
| ) |
Get current user language from redis, as a cache, and set it in language.
Using redis database as cache, seeks the language in it, if there isn't then get the language from the sql database and store it (with default expiring of one day) in redis. It also change $language parameter of the bot to the language returned.
| $default_language | Optional. Default language to return in case of errors. |
| $expiring_time | Optional. Set the expiring time for the language on redis each time it is took from the sql database. |
| DanySpin97\PhpBotFramework\Bot::setLanguageRedisAsCache | ( | $language, | |
$expiring_time = '86400' |
|||
| ) |
Set the current user language in both redis, sql database and $language.
Save it on database first, then create the expiring key on redis.
| $language | The new language to set. |
| $expiring_time | Optional. Time for the language key in redis to expire. |
1.8.12