endyjasmi / cuid
此包已被废弃,不再维护。没有建议的替代包。
Cuid php 版本
2.1.0
2020-01-02 02:46 UTC
Requires
- php: >= 5.4
Requires (Dev)
This package is auto-updated.
Last update: 2023-03-09 03:23:40 UTC
README
此包已被弃用,推荐使用 CUID2。
Cuid for PHP 
此库提供用于水平扩展和顺序查找性能的防碰撞 ID(散列)。本 README 仅涵盖基本细节和 PHP 特定实现。
请参考原始项目以获取项目的完整描述。
要求
- PHP 5.4 及以上
安装
此库可以通过 composer 安装。只需将以下内容添加到您的 composer.json
文件中,然后运行 composer install
。
{ "require": { "endyjasmi/cuid": "2.*" } }
快速开始
以下是如何使用它的示例
// Include composer autoloader require 'vendor/autoload.php'; // Create a cuid instance $cuid = new EndyJasmi\Cuid; // Generate normal cuid $normalCuid = $cuid->cuid(); // ci27flk5w0002adx5dhyvzye2 // Generate short cuid $shortCuid = $cuid->slug(); // 6503a5k0 // You can also generate cuid using static method $normalCuid = Cuid::cuid(); $shortCuid = Cuid::slug(); // There is also an alias method for better readability $normalCuid = Cuid::make();
许可
此库按照以下内容以 MIT 许可授权。完整的许可协议可以在 LICENSE
文件中找到。
The MIT License (MIT)
Copyright (c) 2014 Endy Jasmi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
反馈
想要和我打招呼吗?您可以通过 endyjasmi@gmail.com 或