danaketh / sms-manager
用于通过 SmsManager.cz 发送短信的 PHP 库
v0.2.2
2023-09-13 15:20 UTC
Requires
- php: ^7.4 | ^8
- ext-dom: *
- ext-libxml: *
- ext-simplexml: *
- beberlei/assert: ^3.1
- guzzlehttp/guzzle: ^7.5
Requires (Dev)
- doctrine/coding-standard: ^10.0
- phpstan/phpstan: ^1.9
- phpstan/phpstan-beberlei-assert: ^1.0
- phpstan/phpstan-phpunit: ^1.3
- phpstan/phpstan-strict-rules: ^1.4
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-13 17:47:51 UTC
README
PHP库,可通过 SmsManager.cz 网关发送短信。SMSManager 的 PHP8 分支 SMSManager。 (目前并未实现所有 API 方法)
安装
composer require danaketh/sms-manager
使用方法
在您的代码中使用 SmsManager
接口,例如。
public function __construct(SmsManager $smsManager) { ... }
并将 SMSManager 别名为 ApiSmsManager
用于您的生产环境。
Symfony 示例
services: SimPod\SmsManager\SmsManager: alias: SimPod\SmsManager\ApiSmsManager
要发送消息,创建一个新的 SmsMessage
$smsMessage = new SmsMessage( 'message text', [ '+420777888999' ], RequestType::getRequestTypeLow() // optional, defaults to High 'sender' // optional 1 // optional, CustomID ); $smsManager->send($smsMessage);
SmsMessage
的第三个参数是 RequestType,由 RequestType
类表示。例如,低请求类型通过 RequestType::getRequestTypeLow()
实例化。