1. Go to this page and download the library: Download hyancat/short-messenger 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/ */
// 配置驱动
$manager = new SmsManager();
$manager->config($config);
$manager->extend('aliyun', function () use ($config) {
return new AliyunProvider($config['providers']['aliyun']);
});
$manager->extend('sendcloud', function () use ($config) {
return new SendCloudProvider($config['providers']['sendcloud']);
});
// 创建 Service
$smsService = new SmsService($manager);
$smsService->send('186xxx', function (ShortMessage $message) {
$message->template('template_123')
->signature('SIGNATURE_xx')
->data(['code' => 1234]);
});
use HyanCat\ShortMessenger\SmsServiceFacade as SMS;
SMS::send('18688888888', function (ShortMessage $message) {
$message->template('template_123')
->signature('SIGNATURE_xx')
->data(['code' => 1234]);
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.