PHP code example of vicens / alidayu-for-laravel

1. Go to this page and download the library: Download vicens/alidayu-for-laravel 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/ */

    

vicens / alidayu-for-laravel example snippets


'providers' => [
    // Other service providers...
    \Vicens\AlidayuForLaravel\Providers\AlidayuServiceProvider::class
]

return [
    // other service config
    'alidayu' => [
        'appKey' => '23356838',
        'appSecret' => '254fee5fbabe2e01be04581d855c9af3',
        'sandbox' => false
    ]
];

use Vicens\Alidayu\Alidayu;
// 发送短信通知
$sms = Alidayu::sms($recNum, $smsTemplateCode, $smsFreeSignName, $smsParam, $extend);
// 发送请求并返回响应
$response = $sms->send();

if ($response->success()) {
    // 接口返回成功
    print_r($response->getData());
} else {
    // 接口返回错误
    echo $response->getError();
}