uzbek/eskiz-sms-client
Composer 安装命令:
composer require uzbek/eskiz-sms-client
包简介
Eskiz.uz sms client
README 文档
README
Eskiz.uz sms client for Laravel.
Requirements
- PHP 8.3+
- Laravel 11.x or 12.x
Installation
You can install the package via composer:
composer require uzbek/eskiz-sms-client
You can publish the config file with:
php artisan vendor:publish --tag="eskiz-sms-client-config"
Add the following environment variables to your .env file:
ESKIZ_SMS_EMAIL=your-email@example.com ESKIZ_SMS_PASSWORD=your-password ESKIZ_SMS_FROM=4546
Usage
Sending SMS
use Uzbek\EskizSmsClient\Facades\Sms; // Basic usage $response = Sms::send('998901234567', 'Hello from Laravel!'); if ($response->isOk()) { echo "SMS sent! ID: " . $response->id; } // With custom sender $response = Sms::send('998901234567', 'Hello!', 'CustomSender');
Getting User Info
$user = Sms::user(); echo $user->name; // User name echo $user->email; // User email echo $user->balance; // Account balance echo $user->isActive(); // true/false
Checking Limits
$limits = Sms::limits(); echo $limits->limit; // Total limit echo $limits->used; // Used count echo $limits->remaining; // Remaining count echo $limits->usagePercentage(); // Usage percentage (e.g., 25.5) echo $limits->hasRemaining(); // true/false
Getting Balance
$balance = Sms::balance();
Refreshing Token
Sms::refreshToken();
Exception Handling
The package throws specific exceptions for different error scenarios:
use Uzbek\EskizSmsClient\Exceptions\AuthenticationException; use Uzbek\EskizSmsClient\Exceptions\RateLimitException; use Uzbek\EskizSmsClient\Exceptions\EskizException; try { $response = Sms::send('998901234567', 'Hello!'); } catch (AuthenticationException $e) { // Invalid credentials or token issues } catch (RateLimitException $e) { // Too many requests $retryAfter = $e->retryAfter; // Seconds to wait } catch (EskizException $e) { // Other API errors $response = $e->response; // Raw API response }
Response Objects
All methods return typed response objects:
SendResponse- SMS send result withid,status,message,phoneUserResponse- User info withid,name,email,role,status,balance,isVipLimitResponse- Limits info withlimit,used,remaining,resetAt
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 134
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-06-22