https://github.com/abbas980301/moontelegram
Telegram Bot Updates Type Helper
https://github.com/abbas980301/moontelegram
helper php telegram telegram-bot telegram-bot-helper
Last synced: 5 months ago
JSON representation
Telegram Bot Updates Type Helper
- Host: GitHub
- URL: https://github.com/abbas980301/moontelegram
- Owner: abbas980301
- Created: 2017-06-09T11:45:54.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-12T15:08:53.000Z (almost 9 years ago)
- Last Synced: 2026-01-13T21:13:35.641Z (5 months ago)
- Topics: helper, php, telegram, telegram-bot, telegram-bot-helper
- Language: PHP
- Size: 22.5 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MoonTelegram
[](https://packagist.org/packages/shakibonline/moon-telegram)
[](https://packagist.org/packages/shakibonline/moon-telegram)
[](https://styleci.io/repos/93853503)
> It's a way to use the telegram's response as Object instead of Array
Installation
---------
From your project directory, run
```
composer require shakibonline/moon-telegram
```
Examples
---------
```php
require_once 'vendor/autoload.php';
/**
* @var array $update
*/
$message = new \Shakibonline\Message($update);
echo $message->Text() . PHP_EOL;
echo $message->Chat()->ID() . PHP_EOL;
echo $message->Chat()->Type() . PHP_EOL;
```
Check The type
```php
/**
* @var array $update
*/
$type = MoonTelegram::Type($update);
if ( $type === MoonTelegram::MESSAGE ) {
$message = new Message($update);
$chat = $message->Chat();
} elseif ( $type === MoonTelegram::CALLBACK_QUERY ) {
$callback = new CallbackQuery($update);
$chat = $callback->Message()->Chat();
}
```
See [`Examples`](https://github.com/shakibonline/MoonTelegram/tree/master/Examples) folder
Contact me
------------
You can contact me [via Telegram](https://telegram.me/abbasShakiba) (EN and FA) but if you have an issue please [open](https://github.com/shakibonline/MoonTelegram/issues) one.
# Pull Request
------------
Your welcome to any pull requests.