Download the PHP package mzh/hyperf-jwt without Composer

On this page you can find all versions of the php package mzh/hyperf-jwt. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package hyperf-jwt

基于Hyperf(https://doc.hyperf.io/#/zh/README) 框架的 jwt 鉴权

Stable Version Build Status Total Downloads Monthly Downloads Php Version Swoole Version  License

思路来源与 (https://github.com/phper666/jwt-auth)组件

重构sso单点登录token失效逻辑

说明:

hyperf-jwt 支持单点登录、多点登录、支持注销 token(token会失效)、支持refresh换取新token 失效老token

单点登录:只会有一个 token 生效,一旦刷新 token ,前面生成的 token 都会失效,一般以用户 id 来做区分

多点登录:token 不做限制

单点登录原理:token版本号,JWT 单点登录必须用到 aud(接收方) 默认字段,aud 字段的值默认为用户 id。当生成 token 时,会更新白名单uid的key值为当前的版本号,但是如果是调用 refreshToken 来刷新 token 或者调用 logout 注销token,默认前面生成的 token 都会失效。
如果开启单点登录模式,每次验证时候会查询当前uid的对应key是否和当前的版本号对应

多点登录原理:暂未实现

token 不做限制原理:token 不做限制,在 token 有效的时间内都能使用

使用:

1、安装依赖
2、发布配置
3、jwt配置

去配置 config/autoload/jwt.php 文件或者在配置文件 .env 里配置

更多的配置请到 config/autoload/jwt.php 查看

4、模拟登录获取token

注意:支持传入用户对象获取 token,支持token类型,

5、使用例子参考 https://github.com/lphkxd/hyperf-admin
6、建议

目前 jwt 抛出的异常目前有两种类型 Mzh\JwtAuth\Exception\TokenValidExceptionMzh\JwtAuth\Exception\JWTException,TokenValidException 异常为 token 验证失败的异常,会抛出 401 ,JWTException 异常会抛出 500,最好你们自己在项目异常重新返回错误信息


All versions of hyperf-jwt with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
ext-swoole Version >=4.5
hyperf/config Version ~2.0.0
hyperf/utils Version ~2.0.0
hyperf/framework Version ~2.0.0
hyperf/di Version ~2.0.0
ext-json Version *
ext-redis Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mzh/hyperf-jwt contains the following files

Loading the files please wait ....