PHP code example of yaoshanliang / phpsms

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

    

yaoshanliang / phpsms example snippets


composer 

//example:
Sms::agents([
    'Chuanglan' => [
        //短信API key
        'apiAccount' => 'your api key',
        //短信API Password
        'apiPassword' => 'your api password',
        //代理器
        'agentClass' => 'Yaoshanliang\PhpSms\ChuanglanAgent',
    ]
]);

//example:
Sms::enable([
    //被使用概率为2/3
    'Chuanglan' => '20',

    //被使用概率为1/3,且为备用代理器
    'YunPian' => '10 backup',

    //仅为备用代理器
    'YunTongXun' => '0 backup',
]);

//服务提供器
'providers' => [
    ...
    Toplan\PhpSms\PhpSmsServiceProvider::class,
]

//别名
'aliases' => [
    ...
    'PhpSms' => Toplan\PhpSms\Facades\Sms::class,
]

php artisan vendor:publish

PhpSms::make()->to($to)->content($content)->send();