PHP code example of mmhk / mm-laravel-sms

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

    

mmhk / mm-laravel-sms example snippets


\MMHK\SMS\SMSServiceProvider::class,

[

    //是否伪装已经发送SMS了
    'pretend' => env('SMS_PRETEND', true),

    // 默认的短信服务商
    'default' => env('SMS_DRIVER', 'accessYou'),

    //找回密码时临时密码的生命周期
    'lifetime' => env('SMS_AUTH_LIFE_TIME',30),

    /**
     * 是否使用队列
     */
    'queue' => env('SMS_QUEUE', false),

    /**
     * SMS服务提供商配置
     */
    'services' => [

        'accessYou' => [
            //具体实现类
            'driver' => '\MMHK\SMS\Gateways\AccessYou',
            //实现类的配置
            'config' => [
                'accountno' => '',
                'pwd'       => '',
                'from'      => '',
                'size'      => 'l',
            ]
        ],

        'xGate' => [
            //具体实现类
            'driver' => '\MMHK\SMS\Gateways\XGate',
            //实现类的配置
            'config' => [
                'UserID'          => '',
                'UserPassword'    => '',
                'MessageType'     => '',
                'MessageLanguage' => '',
                'Senderid'        => '',
            ]
        ],

        'WaveCell' => [
            //具体实现类
            'driver' => '\MMHK\SMS\Gateways\WaveCell',
            //实现类的配置
            'config' => [
                'api_key'     => '',
                'account_id'  => '',
                'sender_id'   => '',
            ],
        ],
    ],

    //需要开发测试环境接收短信的白名单
    'whitelist' => [

    ],
];

app('sms')->send(new \MMHK\SMS\Message([
    'to' => 'your mobile number',
    'content' => 'Hello World!',
]));
bash
php artisan vendor:publish --provider="MMHK\SMS\SMSServiceProvider" --tag=config