PHP code example of larva / laravel-auth-signature-guard
1. Go to this page and download the library: Download larva/laravel-auth-signature-guard 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/ */
larva / laravel-auth-signature-guard example snippets
//认证配置
/config/auth.php
//增加一个看守器
'guards' => [
'web'=>[],//原WEB的
'api'=>[],//原API
'signature'=>[//新增的
'driver'=>'signature'
'provider'=>'users',
]
]
// 使用时在控制器中
class SDKController extends Controller
{
public function __construct()
{
$this->middleware('auth:signature');
}
}
//按照以上配置,该控制器所有的方法都会经过签名看守器认证。