xxc / smsgateway-sender
1.0
2018-11-04 14:43 UTC
Requires
- php: >=5.5.9
- guzzlehttp/guzzle: ^6.2
- illuminate/config: ^5.0
- illuminate/support: ^5.0
Requires (Dev)
- mockery/mockery: ^1.2
- phpunit/phpunit: ~4.0
This package is auto-updated.
Last update: 2024-09-21 20:46:20 UTC
README
### AMDTelecom SMSGateway 包 This package is for standard php project use, but has optimisations for laravel usage.
## 安装 composer require xxc/smsgateway-sender
对于 Laravel,如果你不使用包发现,请添加
xXc\SmsGatewaySender\SmsGatewaySenderServiceProvider::class
to config/app.php
## 使用
期望使用
try { $smsGatewaySender = new \xXc\SmsGatewaySender(); $response = $smsGatewaySender ->from('') ->to('') ->message('') ->send(); if ($response->isSent()) { //do whatever } else { //log errors $response->errors //return error message } } catch (\Exception $exception) { //log data //return error based on the exception message?! }
可以通过构造函数或设置器使用自定义验证器来覆盖自定义验证器。所有的自定义验证器都必须继承 Validator 接口
$smsGatewaySender = new \xXc\SmsGatewaySender($customPhoneValidator, $customMessageValidator); \\or $smsGatewaySender = new \xXc\SmsGatewaySender(); $smsGatewaySender->setPhoneValidator($customPhoneValidator); $smsGatewaySender->setMessageValidator($customMessageValidator);
发布配置
php artisan vendor:publish
然后选择 xXc\SmsServiceProvider 标签
贡献:你可以创建用于电话号码或短信(如果需要)的自定义验证器,并创建 pull requests