PHP code example of xin / sms

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

    

xin / sms example snippets


'defaults' => [
    'strategy' => OrderStrategy::class,  // 网关调用策略,默认顺序调用
    'gateways' => [],                   // 默认可用的发送网关
]

// 创建 SmsManager 实例
$smsManager = new Xin\Sms\SmsManager($config);

// 获取默认通道
$channel = $smsManager->channel();

// 获取指定名称的通道
$channel = $smsManager->channel('aliyun');

$config = [
    'defaults' => [
        'strategy' => \Overtrue\EasySms\Strategies\OrderStrategy::class,
        'channel' => 'default',
        'gateways' => [
            'aliyun',
            'qcloud'
        ],
    ],
    'channels' => [
        'aliyun' => [
            'access_key_id' => 'your-access-key',
            'access_key_secret' => 'your-secret-key',
            'sign_name' => 'your-sign-name',
        ],
        'qcloud' => [
            'sdk_app_id' => 'your-app-id',
            'secret_id' => 'your-secret-id',
            'secret_key' => 'your-secret-key',
        ]
    ]
];