PHP code example of yiche / ali-dy

1. Go to this page and download the library: Download yiche/ali-dy 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/ */

    

yiche / ali-dy example snippets


$config    = [
    'accessKeyId'     => 'xxxx',
    'accessKeySecret' => 'xxx',
    'signName'        => 'xxx',
    'templateCode'    => 'xxx',
];
$smsClient = new \Yiche\AliDy\SMSDy($config);

$res = $smsClient->sendSMS('17602191131', [
    'TemplateParam' => [
        // 这个里面是短信模板中的变量,根据实际情况设置变量名称
        'code' => 'xx'
    ]
]);

var_dump($res);