PHPackages                             somarkesen/telegram-gateway - 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. [API Development](/categories/api)
4. /
5. somarkesen/telegram-gateway

ActiveLibrary[API Development](/categories/api)

somarkesen/telegram-gateway
===========================

A Laravel package for sending verification codes via Telegram Gateway API

1.2.0(1y ago)311.4k↓37.5%7[1 PRs](https://github.com/somarkn99/laravel-telegram-gateway/pulls)MITPHPPHP ^7.4|^8.0

Since Oct 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/somarkn99/laravel-telegram-gateway)[ Packagist](https://packagist.org/packages/somarkesen/telegram-gateway)[ RSS](/packages/somarkesen-telegram-gateway/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (4)Used By (0)

Telegram Gateway Laravel Package
================================

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

This Laravel package provides an easy-to-use interface for sending verification codes via Telegram using the Telegram Gateway API.

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

[](#installation)

1. Install the package via Composer:

```
composer require somarkesen/telegram-gateway
```

2. Publish the configuration file:

```
php artisan vendor:publish --provider="SomarKesen\TelegramGateway\Providers\TelegramGatewayServiceProvider"
```

3. Add your Telegram API token in the `.env` file:

```
TELEGRAM_API_TOKEN=your-telegram-api-token
```

### Obtaining the Telegram API Token:

[](#obtaining-the-telegram-api-token)

To use this package, you need to get an API token from Telegram Gateway.

1. Visit the Telegram Gateway API page: .
2. Log in using your **Telegram phone number**.
3. After logging in, you will be able to **fund your account** and view your **API token**.
4. Copy the token and add it to your Laravel `.env` file as shown above.

> Ensure your account is funded and your API token is valid, as this token will be required for all API requests.

Configuration
-------------

[](#configuration)

After publishing, you can find the configuration file at `config/telegram_gateway.php`. This file contains the API URL and timeout settings.

```
return [
    'api_url' => env('TELEGRAM_API_URL', 'https://gatewayapi.telegram.org/'),
    'token' => env('TELEGRAM_API_TOKEN'),
    'timeout' => 30, // Timeout for API requests in seconds
];
```

Usage
-----

[](#usage)

### Sending a Verification Message

[](#sending-a-verification-message)

To send a verification message, you can use the `TelegramGateway` facade:

```
use SomarKesen\TelegramGateway\Facades\TelegramGateway;

$response = TelegramGateway::sendVerificationMessage('+1234567890', [
    'code' => '1234',
    'ttl' => 300,
    'callback_url' => 'https://yourapp.com/callback',
]);
```

The `sendVerificationMessage` method accepts the following parameters:

- `phone_number` (string, required): The phone number to which the verification message will be sent.
- `code` (string, optional): The verification code to send. If omitted, Telegram will generate a random code.
- `ttl` (integer, optional): Time-to-live in seconds for the message before it expires.
- `callback_url` (string, optional): URL to receive delivery status updates.

### Checking Send Ability

[](#checking-send-ability)

To check whether a verification message can be sent to a phone number:

```
$response = TelegramGateway::checkSendAbility('+1234567890');
```

### Checking Verification Status

[](#checking-verification-status)

To check the status of a verification message that was sent previously:

```
$response = TelegramGateway::checkVerificationStatus('request-id', '1234');
```

The `checkVerificationStatus` method accepts:

- `request_id` (string, required): The unique identifier of the verification request.
- `code` (string, optional): The code entered by the user. This can verify if the code is valid.

### Revoking a Verification Message

[](#revoking-a-verification-message)

To revoke a previously sent verification message:

```
$response = TelegramGateway::revokeVerificationMessage('request-id');
```

The `revokeVerificationMessage` method accepts:

- `request_id` (string, required): The unique identifier of the verification request to revoke.

Available Methods
-----------------

[](#available-methods)

- **sendVerificationMessage**: Sends a verification message.
- **checkSendAbility**: Checks if a verification message can be sent to a phone number.
- **checkVerificationStatus**: Checks the status of a previously sent verification message.
- **revokeVerificationMessage**: Revokes a previously sent verification message.

Testing
-------

[](#testing)

To run the tests:

```
composer test
```

Credits
-------

[](#credits)

- [Somar kesen](https://www.linkedin.com/in/somarkesen/)
- [Yhya Nesb](https://www.linkedin.com/in/yhya-nesb/)

License
-------

[](#license)

This package is open-source and available under the MIT license.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.9% 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.

###  Release Activity

Cadence

Every ~18 days

Total

3

Last Release

544d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fe7dcc91c20617cded37a29c62a453957d062954b62ff058f03bece8b5e0bbb6?d=identicon)[somarkn99](/maintainers/somarkn99)

---

Top Contributors

[![somarkn99](https://avatars.githubusercontent.com/u/44697004?v=4)](https://github.com/somarkn99 "somarkn99 (8 commits)")[![yhyasyrian](https://avatars.githubusercontent.com/u/77106078?v=4)](https://github.com/yhyasyrian "yhyasyrian (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/somarkesen-telegram-gateway/health.svg)

```
[![Health](https://phpackages.com/badges/somarkesen-telegram-gateway/health.svg)](https://phpackages.com/packages/somarkesen-telegram-gateway)
```

###  Alternatives

[skagarwal/google-places-api

Google Places Api

1913.0M8](/packages/skagarwal-google-places-api)[dcblogdev/laravel-microsoft-graph

A Laravel Microsoft Graph API (Office365) package

168285.5k1](/packages/dcblogdev-laravel-microsoft-graph)[vluzrmos/slack-api

Wrapper for Slack.com WEB API.

102589.1k3](/packages/vluzrmos-slack-api)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1344.8k1](/packages/jasara-php-amzn-selling-partner-api)[grantholle/powerschool-api

A Laravel package to make interacting with PowerSchool less painful.

1715.6k1](/packages/grantholle-powerschool-api)

PHPackages © 2026

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