bitnix/identity 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

bitnix/identity

最新稳定版本:0.1.0

Composer 安装命令:

composer require bitnix/identity

包简介

README 文档

README

Small, lightweight PHP library for working with identity value objects like UUIDs. Currently only UUIDv4 and UUIDv7 are supported.

Features

  • Small and easy to use
  • Creates domain-specific UUID types by composing the abstract UUID class with specific traits

Installation

Install via Composer:

composer require bitnix/identity

Usage

Example: UUIDv4


namespace App\Engine;

use Bitnix\Identity\Uuid;
use Bitnix\Identity\Uuid4;

final class AppSecret extends Uuid {
    use Uuid4;
}

$uuid = new AppSecret();

// or...

$value = '23a84767-8e2c-41c4-8a8d-0a64bfc1344d'; // user input, db, ...
$uuid = new AppSecret($value);

// readonly string
echo $uuid->value;

// readonly int
echo $uuid->version;

Example: UUIDv7


namespace App\Documents;

use Bitnix\Identity\Uuid;
use Bitnix\Identity\Uuid7;

final class DocumentId extends Uuid {
    use Uuid7;
}

Example: UUID comparison


$uuid1 = new DocumentId();
$uuid2 = new DocumentId($uuid1->value);

if ($uuid1->equals($uuid2)) {
    // same uuid value, version and type
}


Tests

Run tests with PHPUnit:

composer test

or, to get a coverage report at test/.phpunit/coverage:

composer testc

Contributing

  • Fork the repo, create a feature branch, open a pull request.
  • Keep changes small and documented.
  • Add tests for new functionality.

License

Released under AGPL-3.0-or-later License.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: AGPL-3.0-or-later
  • 更新时间: 2025-09-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固