定制 reshadman/bijective-shortener 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

reshadman/bijective-shortener

最新稳定版本:1.0

Composer 安装命令:

composer require reshadman/bijective-shortener

包简介

A Clean Bijective Base Converter for PHP

README 文档

README

This package is a bijective shortener which shortens your unique integer identifier(like a mysql auto increment key) to a unique short string, the strategy simply makes a number with a longer base.

Usage

You can set the characters which you want to be included into the shortened string, by default a random string is set. You should note that this is not an encrypting solution it's just an encoding solution like base_64 but in a bigger base, but by making a random sort of allowed characters you can gaurantee that it is impossible to guess a long number given a shortened string.

<?php
use \Reshadman\BijectiveShortener\BijectiveShortener;

BijectiveShortener::setChars(
    'YRCAtS2qcL06JzFeWIsf9HbwgVPUoOkrZpaGm47vjNEuMT1dynlDxXhQK8i5B3'
);

$shortened = BijectiveShortener::makeFromInteger($int = 60500);

$decoded = BijectiveShortener::decodeToInteger($shortened);

echo 'The Shortened version of ' . $int ' is' . $shortened '\n';
echo 'The decoded version of ' . $shortened ' is ' . $decoded ' which is equal to original number(' . $int ')';

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-03-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固