Skip to content

abbas980301/MoonTelegram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MoonTelegram

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.