imemento/jwt 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

imemento/jwt

Composer 安装命令:

composer require imemento/jwt

包简介

Custom JWT logic

README 文档

README

Build Status Latest Stable Version License Total Downloads

A custom JWT Wrapper to be used in iMemento projects. It uses the RS256 algorithm and it is framework independent.

Install

composer require imemento/jwt

Usage

use iMemento\JWT\JWT;

Encoding

To encode a JWT just use the encode static method:

/**
 * $payload object/array
 * $privateKey mixed the key used to sign the token
 */
$token = JWT::encode($payload, $private_key);

Decoding

To decode a JWT we must follow the next steps.

  1. Instantiate the class with the token we want to decode:

    $jwt = new JWT($token);
  2. Get the issuer before checking the signature (used to find the correct public key):

    $issuer = $jwt->getIssuer();
  3. Get the payload and check the signature at the same time:

    $payload = $jwt->decode($public_key);

Additional Classes

Guard.php - Decrypts the token and is used to extract the permissions from it.

Issuer.php - Represents the current application.

Payload.php - Is used to create a standard payload for the JWT.

Test Token Data Structure

统计信息

  • 总下载量: 2.99k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-01-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固