gerlovsky/php-short-id
Composer 安装命令:
composer require gerlovsky/php-short-id
包简介
Short ID generator. The library help you generate short id like youtube, vimeo, bit.ly, etc.
README 文档
README
The library help you generate short id like youtube, vimeo, bit.ly, etc. Short generation (creation) based on numerical ID.
Simple scenarios of using
require('vendor/autoload.php'); $shortId = new \Gerlovsky\ShortId\ShortId();
Creating short ID for a record from in a database
- when an app created a record in an your database with ID 20956
- $shortId->encode(20956) encodes it to 'bfrE'
- you updated the record for ID 20956 and set short_id of the record to 'bfrE'
$id = $shortId->encode(20956); // $id will be 'bfrE' // or with $length = 6 $id = $shortId->encode(20956, 6); // $id will be 'baauC6'
统计信息
- 总下载量: 22
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-05-28