qlimix/uuid

Uuid值对象

2.0.1 2021-02-22 20:26 UTC

This package is auto-updated.

Last update: 2024-09-23 04:41:41 UTC


README

Travis CI Coveralls Packagist MIT License

一个Uuid值对象以及生成uuid的接口。

安装

使用Composer

$ composer require qlimix/uuid

用法

<?php

use Qlimix\Id\Uuid\Uuid;

$uuid = new Uuid('ecf72764-f657-4ae9-9183-135b72bbad32');
$uuid2 = new Uuid('ecf72764-f657-4ae9-9183-135b72bbad32');

$bytes = $uuid->getBytes();
$string = $uuid->toString();

$uuid = Uuid::fromBytes($bytes);

if ($uuid->equals($uuid2)) {
    // the same
}

测试

要使用PHPUnit在本地上运行所有单元测试

$ vendor/bin/phpunit

质量

为确保代码质量,运行grumphp,它将运行所有工具

$ vendor/bin/grumphp run

贡献

有关详细信息,请参阅CONTRIBUTING