PHPackages                             aglipanci/telegrambot - 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. aglipanci/telegrambot

ActiveLibrary

aglipanci/telegrambot
=====================

17PHP

Since Sep 17Pushed 4y ago2 watchersCompare

[ Source](https://github.com/aglipanci/telegrambot)[ Packagist](https://packagist.org/packages/aglipanci/telegrambot)[ RSS](/packages/aglipanci-telegrambot/feed)WikiDiscussions main Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Telegram Bot API Wrapper
================================

[](#laravel-telegram-bot-api-wrapper)

> This package is a simple Laravel wrapper for the [Official Telegram Bot API](https://github.com/php-telegram-bot/core).

Installation
------------

[](#installation)

```
composer require aglipanci/telegrambot
```

Configurations
--------------

[](#configurations)

#### Env

[](#env)

In order for the Telegram Bot to work you need to add the following values to your .env file:

```
TELEGRAMBOT_API_KEY=api-key-here
TELEGRAMBOT_USERNAME=bot-username-here
TELEGRAMBOT_WEBHOOK_URL=webhook-url-here
```

#### Config

[](#config)

To publish the package configuration file, execute the following artisan command:

```
php artisan vendor:publish --provider="AgliPanci\TelegramBot\TelegramBotServiceProvider"
```

The main Telegram class from `Longman\TelegramBot\Telegram` will be available as a facade through `AgliPanci\TelegramBot\Facades\Telegram` and all the original methods can be called statically from everywhere. For example:

```
use \AgliPanci\TelegramBot\Facades\Telegram;
use Longman\TelegramBot\Entities\Update;
use Longman\TelegramBot\Telegram as TelegramBot

Telegram::setUpdateFilter(function (Update $update, TelegramBot $telegram, &$reason = 'Update denied by update_filter') {
    $user_id = $update->getMessage()->getFrom()->getId();
    if ($user_id === 428) {
        return true;
    }

    $reason = "Invalid user with ID {$user_id}";
    return false;
});
```

#### Webhook Route

[](#webhook-route)

On your web.php or api.php add the following line:

```
Route::telegrambot('telegram');
```

If you are using the package route and controller you don't need to populate `TELEGRAMBOT_WEBHOOK_URL`.

#### Setting Webhook

[](#setting-webhook)

After populating `.env` file with the API credentials and webhook URL you need to execute the following command to setup the Webhook URL:

```
php artisan telegram:set:webhook
```

Now you are ready to process requests by the Telegram Bot.

Commands
--------

[](#commands)

### Defaults

[](#defaults)

The default path for the commands it's Bot/Commands insider your App directory. That can be changed in the `telegrambot.php` by changing the commands\_dir key.

```
'commands_dir' => app_path('Bot/Commands')
```

### Generating Commands

[](#generating-commands)

You can generate classes for your commands using the artisan command:

```
php artisan telegram:make:command SomethingCommand
```

This will generate the command structure on the specified command directory (the default is `App/Bot/Commands`). After generating the command the system will be ready to process `/something` from your users.

For more details on how the [Official Telegram Bot API](https://github.com/php-telegram-bot/core) works please read their official documentation.

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity28

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://www.gravatar.com/avatar/6ab3935dbfd17d02014b655a60004bf9f43a9367c3365d36c2308297eb01b158?d=identicon)[aglipanci](/maintainers/aglipanci)

---

Top Contributors

[![aglipanci](https://avatars.githubusercontent.com/u/2675283?v=4)](https://github.com/aglipanci "aglipanci (6 commits)")

### Embed Badge

![Health badge](/badges/aglipanci-telegrambot/health.svg)

```
[![Health](https://phpackages.com/badges/aglipanci-telegrambot/health.svg)](https://phpackages.com/packages/aglipanci-telegrambot)
```

PHPackages © 2026

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