Download the PHP package fx/hyperf-http-auth without Composer
On this page you can find all versions of the php package fx/hyperf-http-auth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package hyperf-http-auth
Hyperf 下 http 认证组件
-
仿照 laravel auth 组件, 抽离出其中的核心逻辑, 形成当前扩展包
-
将 UserProvider 与 Guard 抽离出去, 形成单独扩展包, 方便扩展, 默认使用以下组合
-
fx/eloquent-provider 使用 Eloquent ORM ;
- fx/session-guard 使用 session 作为 guard ;
-
- 2.0 版本开始, 需手动安装
fx/eloquent-provider
和fx/session-guard
使用
安装
发布配置文件
创建用户 model 并修改为以下配置
配置依赖扩展
fx/session-guard
依赖hyperf/session
需要正确配置其相关内容 官方文档
在 controller 中使用
扩展 UserProvider
-
实现
Fx\HyperfHttpAuth\Contract\UserProvider
这个抽象类 -
添加
Fx\HyperfHttpAuth\Annotation\UserProviderAnnotation
类注解, 该注解接收一个参数, 为该驱动的名称 - 可参考: fx/eloquent-provider
扩展 Guard
-
实现
Fx\HyperfHttpAuth\Contract\StatefulGuard
这个抽象类 -
添加
Fx\HyperfHttpAuth\Annotation\GuardAnnotation
类注解, 该注解接收一个参数, 为该驱动的名称 - 可参考: fx/session-guard
更新说明
-
2020-05-12: 修复 session guard 中引用 cookie 的问题, 该问题导致登录时无法使用
记住我
-
2019-12-26: 添加
Fx\HyperfHttpAuth\AuthenticateMiddleware
中间件, 未认证通过会抛出Fx\HyperfHttpAuth\Exception\AuthenticationException
-
2019-12-27: 添加自动化测试
-
2020-01-07: 修复:
Fx\HyperfHttpAuth\Contract\Guard::name()
, 更新自动化测试 - 2020-08-17: 修复收集器无法收集到自定义的注解, 该问题会导致
Guard
和UserProvider
无法正常使用
All versions of hyperf-http-auth with dependencies
ext-swoole Version >=4.5
ext-json Version *
hyperf/cache Version 2.1.*
hyperf/config Version 2.1.*
hyperf/utils Version 2.1.*
hyperf/framework Version 2.1.*
hyperf/di Version 2.1.*