2018-03-15 15:04:12 +00:00
|
|
|
# Auth 系统 PHP Client
|
|
|
|
|
|
|
|
|
2018-03-19 06:23:22 +00:00
|
|
|
> 该项目使用 composer 来完成加载
|
2018-03-15 15:04:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2018-03-19 03:15:37 +00:00
|
|
|
执行
|
|
|
|
```bash
|
2018-03-19 06:23:22 +00:00
|
|
|
composer config repositories.php-auth-client vcs git@git.int.haowumc.com:arch/php-auth-client.git
|
2018-03-19 03:15:37 +00:00
|
|
|
composer require arch/php-auth-client
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### 代码中启用
|
|
|
|
|
2018-03-19 08:50:14 +00:00
|
|
|
* 注册中间件
|
|
|
|
|
|
|
|
```php
|
2018-03-19 03:15:37 +00:00
|
|
|
$app->routeMiddleware([
|
|
|
|
'auth' => PdAuth\Middleware\Authenticate::class,
|
|
|
|
]);
|
|
|
|
```
|
2018-03-19 08:50:14 +00:00
|
|
|
|
|
|
|
* 注册服务
|
|
|
|
|
|
|
|
```php
|
2018-03-19 03:15:37 +00:00
|
|
|
$app->register(PdAuth\PdAuthServiceProvider::class);
|
|
|
|
```
|
2018-03-15 15:04:12 +00:00
|
|
|
|
2018-03-19 03:15:37 +00:00
|
|
|
### 配置
|
2018-03-15 15:04:12 +00:00
|
|
|
|
2018-03-19 03:53:36 +00:00
|
|
|
在项目 .env 文件中增加如下配置
|
|
|
|
|
|
|
|
```
|
|
|
|
PDAUTH_APP_ID=appid
|
|
|
|
PDAUTH_SECRET=123456
|
|
|
|
PDAUTH_HOST=http://auth.dev.haowumc.com
|
|
|
|
```
|