meghdadfadaee/eitaa-serializer
最新稳定版本:1.0.0
Composer 安装命令:
composer require meghdadfadaee/eitaa-serializer
包简介
Laravel client for serializing Eitaa TL requests and sending them to the Eitaa gateway.
README 文档
README
Laravel client for serializing Eitaa TL requests, sending them to https://sajad.eitaa.ir/eitaa/, and deserializing the binary response.
Installation
Requires PHP 8.3 or newer and Laravel 12 or newer.
composer require meghdadfadaee/eitaa-serializer
If the package is not published on Packagist yet, install it from the Git repository:
composer config repositories.eitaa-serializer vcs https://github.com/MeghdadFadaee/eitaa-serializer composer require meghdadfadaee/eitaa-serializer:dev-main
For local development from a sibling Laravel project:
composer config repositories.eitaa-serializer path ../eitaa-serializer composer require meghdadfadaee/eitaa-serializer:@dev
Laravel package discovery registers the service provider automatically.
Configuration
Publish the config when you need to override defaults:
php artisan vendor:publish --tag=eitaa-config
Available environment variables:
EITAA_GATEWAY_ENDPOINT=https://sajad.eitaa.ir/eitaa/ EITAA_LAYER=133 EITAA_DEFAULT_IMEI=00__web EITAA_TIMEOUT=30
The package uses its bundled TL schema by default. If you need to customize the schema:
php artisan vendor:publish --tag=eitaa-schema
Then set:
EITAA_SCHEMA_PATH=/absolute/path/to/resources/eitaa/schema.json
Usage
Inject or resolve the client:
use MeghdadFadaee\EitaaSerializer\EitaaGatewayClient; $response = app(EitaaGatewayClient::class)->send( method: 'help.getConfig', params: [], token: null, imei: null, );
Or use the facade:
use MeghdadFadaee\EitaaSerializer\Facades\Eitaa; $response = Eitaa::send('help.getConfig');
Authenticated calls:
$response = app(EitaaGatewayClient::class)->send( method: 'messages.sendMessage', params: [ 'flags' => 0, 'peer' => [ '_' => 'inputPeerUser', 'user_id' => '123456789', 'access_hash' => '987654321', ], 'message' => 'Hello', 'random_id' => (string) random_int(1, PHP_INT_MAX), ], token: $token, imei: $imei, );
TL Value Rules
- TL objects use
_for the constructor predicate, for example['_'=> 'inputPeerSelf']. - Optional fields require the correct
flagsbits from the schema. longvalues should be strings when they can exceed PHP integer range.bytes,int128,int256, andint512can be raw binary strings or arrays of byte integers.
Testing
composer install
composer test
Live Eitaa integration tests are available for no-auth methods. They are disabled by default because they call the external gateway:
EITAA_RUN_INTEGRATION=1 composer test:integration
On PowerShell:
$env:EITAA_RUN_INTEGRATION='1'; composer test:integration
The integration suite currently calls help.getConfig and help.getNearestDc without a token.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-05-09