https://github.com/siyun7/aliyunsms
阿里云短信Laravel(PHP通用)接口 20170525
https://github.com/siyun7/aliyunsms
aliyun-sms dayu-sms-notifications laravel php7
Last synced: 2 months ago
JSON representation
阿里云短信Laravel(PHP通用)接口 20170525
- Host: GitHub
- URL: https://github.com/siyun7/aliyunsms
- Owner: siyun7
- Created: 2017-12-21T07:06:34.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-22T02:38:51.000Z (over 7 years ago)
- Last Synced: 2024-04-03T07:20:51.252Z (about 1 year ago)
- Topics: aliyun-sms, dayu-sms-notifications, laravel, php7
- Language: PHP
- Homepage:
- Size: 25.4 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 介绍
阿里短信,自用* 安装
` composer require l57t7q/aliyun-sms dev-master `## 基于laravel框架的使用方法
* 加载
在config/app的providers中添加
` L57t7q\AliyunSms\ServiceProvider::class `同时,可以选择性添加aliases
控制台运行:
` php artisan vendor:publish `根据新增的` aliyunsms.php ` 文件,在.env文件中添加环境变量:
```
ALIYUN_SMS_AK=your access key
ALIYUN_SMS_AS=your secret key
ALIYUN_SMS_SIGN_NAME=sign name
```* 使用
```
$AliyunSms = new AliyunSms();
$response = $AliyunSms->sendSms('phone number', 'SMS_code', ['name'=> 'value in your template']);
//dump($response);
```## 非laravel框架的使用方法
* 加载方式通过composer,不变
* 使用样例代码如下:```
$config = [
'access_key' => 'your access key',
'access_secret' => 'your access secret',
'sign_name' => 'your sign name',
];$aliSms = new L57t7q\AliyunSms\AliyunSms();
$response = $sms->sendSms('phone number', 'tempplate code', ['name'=> 'value in your template'], $config);
```