Download the PHP package nullform/telegram-gateway without Composer
On this page you can find all versions of the php package nullform/telegram-gateway. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nullform/telegram-gateway
More information about nullform/telegram-gateway
Files in nullform/telegram-gateway
Package telegram-gateway
Short Description PHP client for Telegram Gateway API
License MIT
Homepage https://github.com/nullform/telegram-gateway
Informations about the package telegram-gateway
Telegram Gateway PHP Package
The PHP package for sending verification codes via Telegram Gateway.
The Gateway API is an HTTP-based interface created for developers looking to deliver automated messages, such as verification codes, to users who registered their phone number on Telegram.
Requirements
- PHP >= 5.6
Installation
First, you need to get an access token from your Telegram Gateway account settings: https://gateway.telegram.org.
Usage examples
Simplest example:
Extended example:
You can check send ability first:
Use checkVerificationStatus method to check the status of a verification message that was sent previously. If the code was generated by Telegram for you, you can also verify the correctness of the code entered by the user using this method.
Report delivery
You can receive delivery reports from the Telegram Gateway API. Just pass your callback URL to the sendVerificationMessage method and handle the POST request:
Methods
Client
- Client::__construct(string $token)
- Client::getCurlOptions(): array
- Client::setCurlOptions(array $curlOptions): Client
- Client::setCurlOption(int $option, mixed \$value): Client
- Client::getCurlInfo(): array
- Client::sendVerificationMessage(string $phoneNumber, SendVerificationMessageParameters \$parameters): RequestStatus
- Client::checkSendAbility(string $phoneNumber): RequestStatus
- Client::checkVerificationStatus(string $requestId, ?string \$code = null): RequestStatus
- Client::revokeVerificationMessage(string $requestId): bool
ReportHandler
- ReportHandler::__construct(string $token)
- ReportHandler::receive(): RequestStatus
- ReportHandler::parseReport(string $payload): RequestStatus
- ReportHandler::checkRequest(array $httpRequestHeaders, string \$httpRequestBody): bool
- ReportHandler::getRequestTimestamp(?array $customHttpRequestHeaders = null): int
Tests
For unit tests, you need to create a credentials.php file (see tests/credentials.example.php).
All versions of telegram-gateway with dependencies
ext-json Version *
ext-curl Version *