PHP code example of micromagicman / laravel-telegram-webapp
1. Go to this page and download the library: Download micromagicman/laravel-telegram-webapp 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/ */
micromagicman / laravel-telegram-webapp example snippets
@extends('telegram-webapp::main')
@section('lang', 'CN')
@section('head')
// some scripts, css, meta
@endsection
@section('title', 'My title')
@section('content')
<div id="app-content">
// My spa content
</div>
@endsection
use Micromagicman\TelegramWebApp\Facades\TelegramWebApp;
$response = TelegramWebApp::getMe();
use Micromagicman\TelegramWebApp\Services\TelegramWebAppService;
class MyController extends Controller
{
protected $telegram;
public function __construct(TelegramWebAppService $telegram)
{
$this->telegram = $telegram;
}
public function getBotInfo()
{
$response = $this->telegram->getMe();
return response()->json($response);
}
}