disintegrations/shad-serializer-laravel
Composer 安装命令:
composer require disintegrations/shad-serializer-laravel
包简介
Laravel client for serializing and sending encrypted Shad Messenger requests.
README 文档
README
Laravel client for serializing, encrypting, signing, sending, and decrypting Shad Messenger HTTP API requests.
This is an unofficial package based on observed Shad web-client behavior. The protocol is undocumented and may change.
Installation
Requires PHP 8.4 or newer, OpenSSL, and Laravel 12 or newer. GitHub Actions tests the package on PHP 8.4 and PHP 8.5.
composer require disintegrations/shad-serializer-laravel
Laravel package discovery registers the service provider automatically.
Configuration
php artisan vendor:publish --tag=shad-config
SHAD_API_URL=https://shadmessenger2.iranlms.ir SHAD_API_VERSION=6 SHAD_APP_VERSION=4.4.26 SHAD_LANGUAGE=fa SHAD_TIMEOUT=20
For an existing session, configure SHAD_AUTH and SHAD_PRIVATE_KEY_PEM.
API v6 authorized requests require both values. Keep them secret.
Usage
use Disintegrations\ShadSerializer\ShadClient; $shad = app(ShadClient::class); $sent = $shad->sendCode('98912...'); $session = $shad->signIn('98912...', $sent['phone_code_hash'], '123456'); $shad->registerDevice(); $shad->saveState(storage_path('app/shad-state.json')); $chats = $shad->getChats(); $shad->sendMessage('u0...', 'Hello from Laravel'); $shad->sendFile('u0...', storage_path('app/document.pdf'));
Load a saved session without Laravel's container:
$shad = ShadClient::loadState(storage_path('app/shad-state.json')); $result = $shad->callData('getMySessions');
Use the facade:
use Disintegrations\ShadSerializer\Facades\Shad; $chats = Shad::getChats();
Use the protocol serializer directly:
use Disintegrations\ShadSerializer\Protocol\ShadProtocol; $encrypted = ShadProtocol::encryptData(['method' => 'example'], $auth); $decoded = ShadProtocol::decryptData($encrypted, $auth);
The client also includes the Python package's chat, message, contact, channel, folder, data-center discovery, multipart upload, and ranged download helpers.
Testing
composer install
composer test
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-15