Download the PHP package ctfang/id-to-code without Composer

On this page you can find all versions of the php package ctfang/id-to-code. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package id-to-code

id-to-code

自增int类型的id可逆加密算法

例如mysql自增字段,如果直接在接口中暴露,会暴露出您的系统业务量,哪怕设置id从100000开始,也可以在下个月再看接口就直接知道你系统一个月的运营量

特别是订单号,用户id等直接显示,会直接透露你公司的真实运营信息

这时候可以使用 uuid 或者 时间+机器id+进程id+进程内自增+随机数 编码解决

但是这样处理的code实在太长,而且数据库处理速度没有自增id快,这时候可以使用加密算法,把id转成code给前端,前端传参时候再把code转id完美解决

使用场景

用户对外uid, 订单号

Install

使用

生成加密模板

业务使用

每一个 int 都转化类似 71869931 的code

原理

根据加密模板,替换数字数据,因为只是替换动作,不需要哈希计算,所有速度很快

加密模板是反人类习惯生成的映射表,正常人类看数字是 123456789 有序理解,但是经过加密模板后,可能变成 589647123 无规律

普通id因为是自增的,很容易看出来,但是经过加密编码,1转2,2转5无规律转换,每个位数独立一个加密模板,转换时加个设定位数盐,就是每次都不一样,如果id数由 997 到 998 中间只有一个数字变更,但是在加密算法中 因为盐的不一样,会把前面 99 两个根本没有变动的数字也做了不同模板的替换,也可以得到全部位数都变动的数值


All versions of id-to-code with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ctfang/id-to-code contains the following files

Loading the files please wait ....