PHP code example of shakibonline / moon-telegram

1. Go to this page and download the library: Download shakibonline/moon-telegram library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

shakibonline / moon-telegram example snippets




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

/**
 * @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();
}