PHP code example of overtrue / laravel-easy-sms

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

    

overtrue / laravel-easy-sms example snippets


    'easy-sms' => [
        // HTTP 请求的超时时间(秒)
        'timeout' => 5.0,

        // 默认发送配置
        'default' => [
            // 网关调用策略,默认:顺序调用
            'strategy' => \Overtrue\EasySms\Strategies\OrderStrategy::class,

            // 默认可用的发送网关
            'gateways' => [
                'yunpian', 'aliyun',
            ],
        ],
        // 可用的网关配置
        'gateways' => [
            'errorlog' => [
                'file' => '/tmp/easy-sms.log',
            ],
            'yunpian' => [
                'api_key' => env('EASY_SMS_YUNPIAN_API_KEY'),
            ],
            'aliyun' => [
                'access_key_id' => env('EASY_SMS_ALIYUN_KEY_ID'),
                'access_key_secret' =>  env('EASY_SMS_ALIYUN_API_KEY'),
                'sign_name' => '',
            ],
            //...
        ],
    ],

app('easy-sms')->send(13188888888, [
    'content'  => '您的验证码为: 6379',
    'template' => 'SMS_001',
    'data' => [
        'code' => 6379
    ],
]);