shakibonline/moon-telegram

Telegram helper

0.1.0 2017-07-27 11:03 UTC

README

Total Downloads License StyleCI

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

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

/**
 * @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 folder

Contact me

You can contact me via Telegram (EN and FA) but if you have an issue please open one.

Pull Request

Your welcome to any pull requests.