fengshiyou / laravel-middleware-checklogin by fengshiyou

Laravel dev mid_checklogin util
39
0
2
Package Data
Maintainer Username: fengshiyou
Maintainer Contact: 501453944@qq.com (fsy)
Package Create Date: 2016-12-28
Package Last Update: 2016-12-29
Language: PHP
License: MIT
Last Refreshed: 2024-10-31 03:02:40
Package Statistics
Total Downloads: 39
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 1
Total Open Issues: 0

laravel-middlware-checklogin

laravel开发 常用中间件

  1. 登陆验证:通过登录名(uid)和登陆口令(token)验证
  2. 登陆口令从redis中取
  3. post/get 获取到的登录名和验证口令的变量名可配置
  4. 使用具体的redis库名可配置
  5. composer依赖包 "laravel-dev-common/union-middleware"和"laravel-dev-common/union-config"

使用示例

配置:

config/union.php

<?php

return [
    'mid'=>[
        'checkLogin'=>[
            'redis'=>'default',//redis库,./app/config/database中redis配置中取值
            'token_prefix'=>'tk',//redis中用于token的前缀
            'name_param'=>'uid',//用户登陆名
            'token_param'=>'token',//用户登陆token
        ]
    ]
];

Kernel.php

登陆验证


<?php

namespace App\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
    protected $middleware = [
       \laravel\MidCheckLogin\CheckLoginMiddleware::class,
    ];
    protected $routeMiddleware = [
    ];
}

composer.json

composer依赖包

"require": {
        "laravel-dev-common/union-middleware":"*",
        "laravel-dev-common/union-config":"*",
    },