aracoool/yii2-uuid
Composer 安装命令:
composer require aracoool/yii2-uuid
包简介
Yii 2 UUID Extension. A PHP 7.0+ library for generating RFC 4122 version 3, 4, and 5 universally unique identifiers (UUID).
README 文档
README
Yii 2 UUID Extension. A PHP 7.0+ library for generating RFC 4122 version 3, 4, and 5 universally unique identifiers (UUID).
About
From Wikipedia:
The intent of UUIDs is to enable distributed systems to uniquely identify information without significant central coordination. In this context the word unique should be taken to mean "practically unique" rather than "guaranteed unique". Since the identifiers have a finite size, it is possible for two differing items to share the same identifier. The identifier size and generation process need to be selected so as to make this sufficiently improbable in practice. Anyone can create a UUID and use it to identify something with reasonable confidence that the same identifier will never be unintentionally created by anyone to identify something else. Information labeled with UUIDs can therefore be later combined into a single database without needing to resolve identifier (ID) conflicts.
Installation
The preferred method of installation is via Packagist and Composer. Run the following command to install the package and add it as a requirement to your project's composer.json:
composer require --prefer-dist aracoool/yii2-uuid
Usage
Behavior usage for V4
use \aracoool\yii2-uuid\UuidBehavior /** * @return array */ public function behaviors() { return [ [ 'class' => UuidBehavior::class, 'version' => Uuid::V4 ], ... ]; }
Behavior usage for V3 and V5
use \aracoool\yii2-uuid\UuidBehavior /** * @return array */ public function behaviors() { return [ [ 'class' => UuidBehavior::class, 'version' => Uuid::V3, // Uuid::V5 'namespace' => Uuid::NAMESPACE_NIL, 'nameAttribute' => 'title' // Value of this attribute SHOULD be unique in your database ], ... ]; }
use \aracoool\yii2-uuid\Uuid Uuid::v3(Uuid::NAMESPACE_URL, 'http://example.com/'); Uuid::v5(Uuid::NAMESPACE_DSN, 'www.google.com'); Uuid::v3(Uuid::NAMESPACE_OID, '1.3.6.1'); Uuid::v5(Uuid::NAMESPACE_X500, 'c=ca'); Uuid::v4();
Validator usage
use \aracoool\yii2-uuid\UuidValidator; /** * @return array */ public function rules() { return [ ... ['attribute_id', UuidValidator::class], ... ]; }
aracoool/yii2-uuid 适用场景与选型建议
aracoool/yii2-uuid 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 53.22k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2016 年 11 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「uuid」 「guid」 「yii」 「yii2」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 aracoool/yii2-uuid 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 aracoool/yii2-uuid 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 aracoool/yii2-uuid 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Paramconverter, Normalizer and Form Type for Ramsey Uuid
Yii2 LightBox image galary widget uses Lightbox v2.10.0 by Lokesh Dhakar
A PHP library for generating and working with identifiers, including UUIDs, ULIDs, and Snowflakes
DrUUID RFC 4122 library for PHP
Trait to generate uuid when creating models
Priveate for SkeekS CMS
统计信息
- 总下载量: 53.22k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 30
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-11-11