Download the PHP package somarkesen/telegram-gateway without Composer
On this page you can find all versions of the php package somarkesen/telegram-gateway. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download somarkesen/telegram-gateway
More information about somarkesen/telegram-gateway
Files in somarkesen/telegram-gateway
Package telegram-gateway
Short Description A Laravel package for sending verification codes via Telegram Gateway API
License MIT
Informations about the package telegram-gateway
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
-
Install the package via Composer:
-
Publish the configuration file:
- Add your Telegram API token in the
.env
file:
Obtaining the Telegram API Token:
To use this package, you need to get an API token from Telegram Gateway.
- Visit the Telegram Gateway API page: https://gateway.telegram.org/.
- Log in using your Telegram phone number.
- After logging in, you will be able to fund your account and view your API token.
- 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
After publishing, you can find the configuration file at config/telegram_gateway.php
. This file contains the API URL and timeout settings.
Usage
Sending a Verification Message
To send a verification message, you can use the TelegramGateway
facade:
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
To check whether a verification message can be sent to a phone number:
Checking Verification Status
To check the status of a verification message that was sent previously:
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
To revoke a previously sent verification message:
The revokeVerificationMessage
method accepts:
request_id
(string, required): The unique identifier of the verification request to revoke.
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
To run the tests:
Credits
License
This package is open-source and available under the MIT license.
All versions of telegram-gateway with dependencies
illuminate/support Version ^8.0|^9.0|^10.0|^11.0
guzzlehttp/guzzle Version ^7.0