yanthink / sms by yanthink

亿美软通、建周、3G新传媒短信接口
190
1
2
Package Data
Maintainer Username: yanthink
Maintainer Contact: yanthink911@qq.com (yanthink)
Package Create Date: 2017-07-12
Package Last Update: 2017-07-14
Language: PHP
License: MIT
Last Refreshed: 2024-11-23 03:05:57
Package Statistics
Total Downloads: 190
Monthly Downloads: 3
Daily Downloads: 0
Total Stars: 1
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

sms

亿美软通、建周、3G新传媒短信接口

安装

  1. 打开终端执行下面命令:
composer require yanthink/sms
  1. 打开 config/app.php 然后将下面内容添加到 providers 数组中:
Yanthink\Sms\SmsServiceProvider::class,
  1. 将下面内容添加到 config/app.php 文件的 aliases 数组中:
'Sms' => Yanthink\Sms\Facades\Sms::class,
  1. 在终端执行下面命令:
php artisan vendor:publish --provider="Yanthink\Sms\SmsServiceProvider"

使用

    <?php
    
    namespace App\Http\Controllers;
    
    use Yanthink\Sms\Contracts\Sms;
    use Carbon\Carbon;
    
    class SmsController extends Controller
    {
        public function index(Sms $sms)
        {
            $sms->send('13000000000', '短信内容'); // 发送普通短信
            $sms->send('13000000000', '短信内容', Carbon::now()->addMinutes(10)); // 发送定时短信
            $sms->sendVoice('13000000000', '123456'); // 发送语音
            $sms->getBalance(); // 获取短信余额
        }
    }