承接 joanfabregat/secure-token-generator 相关项目开发

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

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

joanfabregat/secure-token-generator

最新稳定版本:v1.3

Composer 安装命令:

composer require joanfabregat/secure-token-generator

包简介

Generate cryptographically secure alphanumeric tokens in PHP

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License

Generate cryptographically secure alphanumeric tokens in PHP 8.2+ using PHP random_int() function.

Installation

The package is available on Packagist. The recommended way to install the library is through Composer:

composer require joanfabregat/secure-token-generator

Usage

use JoanFabregat\SecureTokenGenerator\SecureTokenGenerator;

// A simple token
$token = SecureTokenGenerator::generate(16);
echo $token; // will echo a 16 characters long alphanumeric token

// With all the options
$token = SecureTokenGenerator::generate(
    length: 32, 
    allowDigits: true, // 1234567890
    allowSpecialChars: true, // !@#$%^&*()_+{}|:"<>?[];',./
    allowUppercase: true, // ABCDEFGHIJKLMNOPQRSTUVWXYZ
    allowLowercase: true, // abcdefghijklmnopqrstuvwxyz
);
echo $token; // will echo a 32 characters long alphanumeric token with special characters

// An integer token
$token = SecureTokenGenerator::generateInt(6);
echo is_int($token); // will echo true
echo $token; // will echo a 6 digits long integer token (ie. 123456)

License

The library is published under the MIT license (see LICENSE file).

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-04-29