ngubin/key-n
Composer 安装命令:
composer require ngubin/key-n
包简介
Generation a unique short key from the number.
README 文档
README
Generating a unique short key from the number.
A simple library for converting a number into a string key and back. You can use to shorten long numbers to unique keys.
Example Usage
Creating a key from a number:
You can only encode an integer greater than or equal to one.
use KeyN\Make\Key62; $instance = Key62::make(); $key = $instance->encode(100000);
Set your own character set to create keys:
use KeyN\Make\Key62; $characters = 'wWpJbH8nIDed1Evq5OcToF2ZuXsayz7RrtP490ixSKC3GM6gYkNVhBUQmLlfAj'; $instance = Key62::make($characters); $key = $instance->encode(100000);
Getting the number from the key:
You can decode the key if all of its characters are in the class set.
use KeyN\Make\Key62; $instance = Key62::make(); $number = $instance->decode('Gh1a');
License
This project is released under the MIT License.
© 2020 Nik Gubin, All rights reserved.
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-07-09