huangdijia / laravel-sms
laravel 的短信功能
1.1.7
2020-11-24 10:13 UTC
Requires
- php: >=7.2.0
- alibabacloud/client: ^1.5
- guzzlehttp/guzzle: ^6.4|^7.0
- illuminate/contracts: ^7.0|^8.0
- illuminate/notifications: ^7.0|^8.0
- illuminate/support: ^7.0|^8.0
Requires (Dev)
- orchestra/testbench: ^5.0
README
安装
安装包
composer require huangdijia/laravel-sms
配置安装
php artisan sms:install
使用
发送短信简单易用
use Huangdijia\Sms\Facades\Sms; Sms::to('phone number')->content('message content')->send();
检查发送结果
$response = Sms::to('phone number')->content('message content')->send(); if ($response->successful()) { // success }
抛出异常
$response = Sms::to('phone number')->content('message content')->send(); $response->throw();
切换短信工厂
Sms::use('another')->to('phone number')->content('message content')->send();
使用验证规则
Sms::withRules([ 'to' => 'required|numeric|....', 'content' => 'required|...', ], [ 'to.required' => ':attribute cannot be empty!', 'content.required' => ':attribute cannot be empty!', // more messages ])->to()->content()->send();