PHPackages                             php-core/laravel-telegram-webapp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. php-core/laravel-telegram-webapp

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

php-core/laravel-telegram-webapp
================================

Laravel middleware for Telegram WebApp data validation

04PHP

Since Nov 16Pushed 6mo agoCompare

[ Source](https://github.com/php-core/laravel-telegram-webapp)[ Packagist](https://packagist.org/packages/php-core/laravel-telegram-webapp)[ RSS](/packages/php-core-laravel-telegram-webapp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Telegram WebApp package
===============================

[](#laravel-telegram-webapp-package)

[![build](https://github.com/php-core/laravel-telegram-webapp/actions/workflows/laravel-telegram-webapp-ci.yml/badge.svg)](https://github.com/php-core/laravel-telegram-webapp/actions/workflows/laravel-telegram-webapp-ci.yml/badge.svg)[![codecov](https://camo.githubusercontent.com/62f8b74b088cf47efcf26f15a0e17f85e3ed6fc1364dbbd5e371471ccffb9595/68747470733a2f2f636f6465636f762e696f2f6769746875622f7068702d636f72652f6c61726176656c2d74656c656772616d2d7765626170702f67726170682f62616467652e7376673f746f6b656e3d42413847325437454e36)](https://codecov.io/github/php-core/laravel-telegram-webapp)

Laravel package that allows you to process commands from Telegram MiniApp with user verification according to [Telegram MiniApp developer documentation](https://core.telegram.org/bots/webapps), as well as obtaining information about the Telegram user who sent the request

Requirements
------------

[](#requirements)

Laravelphp-core/laravel-telegram-webapp10.x1.x.x11.x2.x.x12.x3.x.xInstall
-------

[](#install)

### Via composer

[](#via-composer)

```
composer require php-core/laravel-telegram-webapp
```

### Publishing

[](#publishing)

Publish to your Laravel application:

```
php artisan vendor:publish --provider="PHPCore\TelegramWebApp\TelegramWebAppServiceProvider"
```

Configure
---------

[](#configure)

All package configuration available in `config/telegram-webapp.php` file after `publish` command execution:

Config nameDescriptionEnvironmentDefault value`enabled`Telegram MiniApp data validation switch`TELEGRAM_WEBAPP_DATA_VALIDATION_ENABLED``true``webAppScriptLocation`Path to script (.js) which initializes Telegram MiniApp on your frontend app-`https://telegram.org/js/telegram-web-app.js``botToken`Your Telegram bot token`TELEGRAM_BOT_TOKEN`-`error.status`HTTP status code when Telegram MiniApp data validation fails-403 (Forbidden)`error.message`Error message returned when Telegram MiniApp data validation fails-403 (Forbidden)`authDateLifetimeSeconds`The lifetime of the Telegram initData auth\_date parameter in seconds. The request to the server must be made within this interval, otherwise the data transmitted from Telegram will be considered invalid. The values of the parameter &lt;= 0 imply that there is no verification of the lifetime of data from telegram and the auth\_date parameter is not validated-0Example in code:

View
----

[](#view)

This package provides a root view for Telegram MiniApp frontend applications. [Telegram WebApp script](https://telegram.org/js/telegram-web-app.js) is automatically includes to this view or its inheritors if `telegram-webapp.enabled` switch is `true`

Example:

```
@extends('telegram-webapp::main')

@section('lang', 'EN')

@section('head')
// some scripts, css, meta
@endsection

@section('title', 'My title')

@section('content')

        // My spa content

@endsection
```

Integration with `TelegramBot\Api\BotApi`
-----------------------------------------

[](#integration-with-telegrambotapibotapi)

Our service integrates with `TelegramBot\Api\BotApi`, allowing you to access all of the methods provided by the Telegram Bot API. This integration is available either through a **Facade** or directly through the service.

You can find the repository for `TelegramBot\Api\BotApi` [here](https://github.com/TelegramBot/Api).

### Using the Facade

[](#using-the-facade)

To use the Telegram Bot API methods, you can leverage the **TelegramWebAppFacade** facade. This provides a simple and convenient way to interact with the Telegram Bot API.

Example usage with the Facade:

```
use PHPCore\TelegramWebApp\Facades\TelegramWebApp;

$response = TelegramWebApp::getMe();
```

This allows you to call methods like `getMe()`, `sendMessage()`, `getUpdates()`, and any other method from the `BotApi` class directly through the facade.

### Using the Service Directly

[](#using-the-service-directly)

You can also interact with the Telegram Bot API directly through the service. Inject the `TelegramWebAppService` into your components, and call the Bot API methods via the service instance.

Example usage in a controller:

```
use PHPCore\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);
    }
}
```

Both the facade and the service offer full access to the `BotApi` class methods, allowing you to work seamlessly with the Telegram Bot API in your Laravel application.

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance47

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/103283996?v=4)[PHP Core](/maintainers/php-core)[@php-core](https://github.com/php-core)

---

Top Contributors

[![micromagicman](https://avatars.githubusercontent.com/u/25100894?v=4)](https://github.com/micromagicman "micromagicman (33 commits)")

### Embed Badge

![Health badge](/badges/php-core-laravel-telegram-webapp/health.svg)

```
[![Health](https://phpackages.com/badges/php-core-laravel-telegram-webapp/health.svg)](https://phpackages.com/packages/php-core-laravel-telegram-webapp)
```

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
