zacksleo / easy-sms-mw
The easiest way to send short message.
Installs: 1 651
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- overtrue/easy-sms: ^1.1
Requires (Dev)
- mockery/mockery: 1.0.x-dev
- phpunit/phpunit: ^5.6
This package is auto-updated.
Last update: 2024-11-08 07:36:11 UTC
README
安装
$ composer require "zacksleo/easy-sms-mw"
通过自定义网关使用
use Overtrue\EasySms\EasySms; use zacksleo\easysms\Gateways\MwGateway; $config = [ ... 'default' => [ 'gateways' => [ 'mw', // 配置自定义网关 ], ], 'gateways' => [ 'mw' => [ 'userId' => 'your-api-key', 'password' => 'your-api-password', 'pszSubPort' => 'psz-sub-port', ], ], ]; $easySms = new EasySms($config); // 注册 $easySms->extend('mw', function($gatewayConfig){ // $gatewayConfig 来自配置文件里的 `gateways.mygateway` return new MwGateway($gatewayConfig); }); $res = $easySms->send(13188888888, [ 'content' => '您的验证码为: 6379', ]); if ($res['mw']['status'] == 'success') { throw new Exception('发送失败'); }
更多内容请参考:easy-sms 文档