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

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

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

codeblog/jwt

Composer 安装命令:

composer require codeblog/jwt

包简介

A simple library to work with JSON Web Token and JSON Web Signature

README 文档

README

Maintainer Source Code PHP from Packagist Latest Version Software License Build Quality Score Total Downloads

JWT is a component that simplifies the handling of authentication in APIs. JWT contains information and metadata that describes the user's entity, authorization data, token validity, valid domain, etc.

JWT é um componente que simplifica o tratamento de autenticação em APIs. JWT contém informações e metadados que descrevem a entidade do usuário, dados de autorização, validade do token, domínio válido, etc.

Highlights

  • Simple installation (Instalação simples)
  • Creating authenticated tokens for API (Criação de tokens autenticados para API)
  • Token authenticity check (Verificação de autenticidade do token)
  • Token expiration check (Verificação de expiração do token)

Installation

JWT is available via Composer:

"codeblog/jwt": "^1.0"

or run

composer require codeblog/jwt

Documentation

For details on how to use, see a sample folder in the component directory. In it you will have an example of use for each class. It works like this:

Para mais detalhes sobre como usar, veja uma pasta de exemplo no diretório do componente. Nela terá um exemplo de uso para cada classe. Ele funciona assim:

Create JWT:

<?php

require __DIR__ . '/../vendor/autoload.php';

use CodeBlog\JWT\JWT;

$key = 'codeblog.com.br'; // your secret key

$payload = array(
    "iss" => "api.dominio.com", // the token emitter. You can use the domain where your api is. Ex: api.domain.com
    "iat" => time(), // The time the JWT was issued. Can be used to determine the age of JWT.
    "exp" => time() + (60 * 60), // This is likely to be the most commonly used registered claim. This will set the expiration on the NumericDate value. The expiration MUST be after the current date / time.
    "data" => [
        "user_id" => 10,
        "user_email" => "fulano@gmail.com"
    ]
);


$jwt = (new JWT)->encode($payload, $key);
var_dump($jwt);

//$decoded = JWT::decode($jwt, $key);
//var_dump($decoded);

Auth JWT:

<?php

require __DIR__ . '/../vendor/autoload.php';

use CodeBlog\JWT\JWT;

$key = 'codeblog.com.br'; // your secret key

$jwt = new JWT();
$token = $jwt->authHeader();

$decoded = $jwt->decode($token, $key);
var_dump($decoded);

Contributing

Please see CONTRIBUTING for details.

Support

Security: If you discover any security related issues, please email whallyssonallain@gmail.com instead of using the issue tracker.

Se você descobrir algum problema relacionado à segurança, envie um e-mail para whallyssonallain@gmail.com em vez de usar o rastreador de problemas.

Thank you

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-03-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固