simpod / sms-manager
该软件包已被废弃,不再维护。未建议替代软件包。
PHP 库,通过 SmsManager.cz 发送短信
v0.1.1
2020-03-29 13:18 UTC
Requires
- php: ^7.2
- ext-dom: *
- ext-simplexml: *
- beberlei/assert: ^3.1
- consistence/consistence: ^1.0 | ^2.0
- guzzlehttp/guzzle: ^6.0
Requires (Dev)
- doctrine/coding-standard: ^7.0
- phpstan/phpstan: ^0.11.5
- phpstan/phpstan-beberlei-assert: ^0.11.0
- phpstan/phpstan-phpunit: ^0.11.0
- phpstan/phpstan-strict-rules: ^0.11.0
- phpunit/phpunit: ^8
This package is auto-updated.
Last update: 2020-03-29 13:21:20 UTC
README
PHP 库,可以通过 SmsManager.cz 网关发送短信消息。 (目前并非所有 API 方法都已实现)
安装
composer require simpod/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()
实例化。