承接 erwane/cakephp-token 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

erwane/cakephp-token

最新稳定版本:3.0.0

Composer 安装命令:

composer require erwane/cakephp-token

包简介

CakePHP plugin for tokens

README 文档

README

Software License codecov Build Status Packagist Downloads Packagist Version

Version map

branch CakePHP core PHP min
1.x ^3.0 PHP 7.2
2.x ^4.0 PHP 7.4
3.x ^5.0 PHP 8.1

Description

This is a really "simple to use" CakePHP plugin for generating and reading temporaries tokens

Installation

composer require erwane/cakephp-token
bin/cake migrations migrate -p Token

Usage

Generate a token

/**
 * Create a token with data and return the id
 * @param  array  $content   an array of custom data
 * @param  string $expire    expire exprimed in '+6 days +2 hours' format
 * @param  int $length Token length
 * @return string            The token id
 */

$myNewTokenId = \Token\Token::generate(array $content, $expire, 8);

Get token

// return null (expired or not found) or Token entity
$token = \Token\Token::get($tokenId);

Delete token

Tokens deletion can be ignored, they will be destroyed on expire, but sometime you need to delete one token immediately

/**
 * Delete token from id or entity
 * 
 * @param \Token\Model\Entity\Token|string $token Token entity or id
 * @return bool True if token was deleted
 */
$result = \Token\Token::delete($token);

Auto cleaning

Each time a token is read, expired tokens are pruned

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-07-20