PHP code example of yanthink / sms

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

    

yanthink / sms example snippets


composer 

Yanthink\Sms\SmsServiceProvider::class,

'Sms' => Yanthink\Sms\Facades\Sms::class,

php artisan vendor:publish --provider="Yanthink\Sms\SmsServiceProvider"

    
    
    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(); // 获取短信余额
        }
    }
config/app.php
config/app.php