PHP code example of laramall / aliyun-dysms

1. Go to this page and download the library: Download laramall/aliyun-dysms library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

laramall / aliyun-dysms example snippets

`
php artisan vendor:publish --provider="LaraMall\AlidySms\AlidySmsServiceProvider"

修改 config/sms.php 中的阿里大于短信相关参数

  	//id
	'ACCESS_KEY_ID'=>'',
	//秘钥
	'ACCESS_KEY_SECRET'=>'',
	//短信签名
	'signName'=>'',
	//短信模板编号
	'templateCode'=>'',
	//短信模板中变量字段
	'field'=>'number',
	//要发送的短信内容
	'content'=>rand(1000,9999),
`
use Sms;

//短信发送成功 下面函数返回 true 反之 false
Sms::put('phone','13800000000')->send();

`
Sms::put('phone',$phone) //接受短信的手机号
   ->put('signName',$signName) //短信签名
   ->put('templateCode',$templateCode) //短信模板编号
   ->put('filed',$field) //短信模板中的变量字段
   ->put('content',$content) //短信中的变量的值 也就是验证码的内容
   ->send(); //发送短信