PHP code example of hzx / hyperf-sms

1. Go to this page and download the library: Download hzx/hyperf-sms 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/ */

    

hzx / hyperf-sms example snippets


php bin/hyperf.php vendor:publish hzx/hyperf-sms

use Hzx\HyperfSms\Contract\SmsInterface;
use Hyperf\Utils\ApplicationContext;

$easySms = ApplicationContext::getContainer()->get(SmsInterface::class);
$result = $easySms->send(18888888888, [
        'content'  => '登录验证码{1},请于5分钟内填写',
        'template' => '1111',
        'data' => [
        'code' => 1234
    ],
]);