qsms/qbiez-sms
Composer 安装命令:
composer require qsms/qbiez-sms
包简介
Laravel package for Qbiez SMS API integration - Phone number formatting, queue support, and real-time delivery reports
README 文档
README
A modern SMS integration package for Laravel applications with comprehensive features and robust error handling.
📋 Requirements
- PHP 8.0+
- Laravel 9.x/10.x/12.x
- Composer
- Active Qbiez SMS account
🚀 Quick Start
Registration
First, register for a free account at https://sms.qbiez.com/register to obtain your API token and sender ID.
Installation Steps
- Install the package via Composer:
composer require qsms/qbiez-sms
- Add the following variables to your
.envfile:
QSMS_API_TOKEN=your_api_token_here QSMS_SENDER_ID=your_sender_id_here QSMS_API_URL=https://sms.qbiez.com/api/http/sms/send QSMS_LOGGING_ENABLED=true QSMS_DEFAULT_COUNTRY_CODE=255 QSMS_LOG_FORMAT=json QSMS_LOG_RETENTION=14 QSMS_RATE_LIMIT=30 QSMS_RATE_WINDOW=60
Basic Usage
use Qsms\QbiezSms\SendSMS; $sms = new SendSMS(); $response = $sms->send('255755270046', 'Hello World!');
⚙️ Advanced Configuration
To use advanced configuration options, follow these steps:
- Create a new file
config/qsms.phpin your Laravel project - Copy the following configuration:
return [ 'api_token' => env('QSMS_API_TOKEN', ''), 'sender_id' => env('QSMS_SENDER_ID', ''), 'api_url' => env('QSMS_API_URL', 'https://sms.qbiez.com/api/http/sms/send'), 'http' => [ 'timeout' => env('QSMS_HTTP_TIMEOUT', 30), 'retry' => [ 'times' => env('QSMS_RETRY_TIMES', 3), 'sleep' => env('QSMS_RETRY_SLEEP', 100), ], ], 'default_country_code' => env('QSMS_DEFAULT_COUNTRY_CODE', '255'), 'logging' => [ 'enabled' => env('QSMS_LOGGING_ENABLED', true), 'path' => storage_path('logs/qsms'), 'level' => env('QSMS_LOG_LEVEL', 'info'), ], ];
- Optionally, publish the configuration file (if you want to customize it further):
php artisan vendor:publish --tag=qsms-config
📱 Features
- Automatic phone number formatting
- Rate limiting protection
- Comprehensive logging
- Error handling
- Message splitting
- Queue support
Phone Number Formats
// All supported formats: $sms->send('255712345678', 'Message'); // International $sms->send('0712345678', 'Message'); // Local with zero $sms->send('712345678', 'Message'); // Local without zero $sms->send('+255712345678', 'Message'); // With plus
Response Handling
$response = $sms->send('255712345678', 'Test'); if ($response['status'] === 'success') { echo "Message sent! ID: " . $response['data']['message_id']; } else { echo "Error: " . $response['message']; }
🧪 Testing
// tests/Feature/SmsTest.php public function test_can_send_sms() { $sms = new SendSMS(); $response = $sms->send('255712345678', 'Test'); $this->assertEquals('success', $response['status']); }
📝 Logging
Logs are stored in storage/logs/qsms/qsms-YYYY-MM-DD.log
{
"timestamp": "2025-04-27 10:30:00",
"level": "info",
"message": "SMS sent",
"context": {
"recipient": "255712345678",
"status": "delivered"
}
}
🔒 Security
- Rate limiting: 10 messages/minute by default
- Secure API token handling
- Phone number validation
- Input sanitization
🤝 Support
📄 License
MIT License. See LICENSE for details.
🔄 Changelog
See CHANGELOG.md for release history.
qsms/qbiez-sms 适用场景与选型建议
qsms/qbiez-sms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 37 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 04 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「sms」 「gateway」 「messaging」 「notification」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 qsms/qbiez-sms 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 qsms/qbiez-sms 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 qsms/qbiez-sms 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
repository php library
Payyo Gateway for the Omnipay payment processing library
A PSR-7 compatible library for making CRUD API endpoints
SDK for payment gateway PlatbaMobilom.sk for PHP7.0
Extensible library for building notifications and sending them via different delivery channels.
yii2-sms expand
统计信息
- 总下载量: 37
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-27