codeblog/jwt
Composer 安装命令:
composer require codeblog/jwt
包简介
A simple library to work with JSON Web Token and JSON Web Signature
README 文档
README
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
- Whallysson Avelino (Developer)
- CodBlog (Team)
- All Contributors (This Rock)
License
The MIT License (MIT). Please see License File for more information.
codeblog/jwt 适用场景与选型建议
codeblog/jwt 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 03 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「jwt」 「JWS」 「CodeBlog」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 codeblog/jwt 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 codeblog/jwt 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 codeblog/jwt 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A simple library to decode and parse Apple Sign In client tokens.
A library to work with JSON Web Token and JSON Web Signature.
Easy WebP conversion library for PHP
JWT API authentication driver (Guard) for Laravel.
Laravel-first JWT and JWS support with profile-driven issuance and validation
This Bundle provides full authentication for login form and also Api with JWS (signed JWT 'encrypted with OpenSSL encryption engine') based on Symfony Guard
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-03-27