tonci14 / laravel-eurosms
通过 https://www.eurosms.com 发送短信的简单服务
v1.04
2022-11-16 06:23 UTC
Requires
- php: ^7.4|^8
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: >=7.4
- laravel/framework: >=v7
Requires (Dev)
- friendsofphp/php-cs-fixer: >=3.5
- phpstan/phpstan: >=1.4
- phpunit/phpunit: >=9.5
README
许可证
MIT © Anton Adamec
安装
添加到 /app/Providers/AppServiceProvider
<?php namespace App\Providers; use Illuminate\Support\ServiceProvider; use Tonci14\LaravelEuroSMS\EuroSmsService; class AppServiceProvider extends ServiceProvider { /** * Register any application services. * * @return void */ public function register() { $this->app->singleton(EuroSmsService::class, function () { return new EuroSmsService( config('sms.eurosms.integrationKey'), config('sms.eurosms.integrationID'), config('sms.eurosms.senderName') ); }); } /** * Bootstrap any application services. * * @return void */ public function boot() { } }
示例用法
同步
$smsService->send("+421****", "Test sms content");
异步
$smsService->sendAsync("+421****", "Test sms content");