siewwp/laravel-service-host
Composer 安装命令:
composer require siewwp/laravel-service-host
包简介
laravel server-to-server service host with HMAC authentication
README 文档
README
Installation
composer require siewwp/laravel-service-host:^1.0.0
Publish service host config
php artisan vendor:publish --provider="Siewwp\LaravelServiceHost\ServiceHostServiceProvider" --tag="config"
Publish service host migration
php artisan vendor:publish --provider="Siewwp\LaravelServiceHost\ServiceHostServiceProvider" --tag="migrations"
Run migration
php artisan migrate
run the command below on console to create host
php artisan service-host:client {name} {webhook_url}
Guide
Authenticating client request
Add clients user provider in your auth.php configuration file.
'providers' => [ 'clients' => [ 'driver' => 'eloquent', 'model' => Siewwp\LaravelServiceHost\Client::class, ], ],
Finally, you may use this provider in your guards configuration:
'guards' => [ 'client' => [ 'driver' => 'service-host', 'provider' => 'clients', ], ],
Sending a webhook notification
To send notification, create a notification and specify WebhookChannel::class like below:
<?php namespace App\Notifications; use Illuminate\Notifications\Notification; use Siewwp\LaravelServiceHost\Channels\WebhookChannel; class InvoicePaid extends Notification { public function via($notifiable) { return [WebhookChannel::class]; } public function toWebhook($notifiable) { return [ // ... ]; } // ... }
TODO
TEST
统计信息
- 总下载量: 132
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-06-10