attla/data-token
Composer 安装命令:
composer require attla/data-token
包简介
Turn everything into a token: randomized or predictable.
README 文档
README
🪅 Turn everything into a token: randomized or predictable.
Installation
composer require attla/data-token
Usage
Creating and managing a token
use Attla\DataToken\Facade as DataToken; // Create with facade $token = DataToken::secrete('your secret phrase'); // Set the issuer claim $token->iss(); // Set the expiration in minutes $token->exp(120); // Set payload of the token $token->payload($model); // Set the browser identifier on token $token->bwr(); // Set user IP on the token $token->ip(); // Get the token $tokenEncoded = $token->encode();
Decoding the token
// Get token value as associative array $tokenValue = DataToken::decode($tokenEncoded, true); // Aliases for decode a token $tokenValue = DataToken::fromString($tokenEncoded); $tokenValue = DataToken::parseString($tokenEncoded); $tokenValue = DataToken::parse($tokenEncoded);
Others ways to make a token
// Make a unique token from anything $id = DataToken::id(123); // Make always the same token $sid = DataToken::sid(123); // Make a strong token $sign = DataToken::sign(123);
List of message methods
License
This package is licensed under the MIT license © Octha.
统计信息
- 总下载量: 22
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 3
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-07-13