qlimix / uuid
Uuid value objects
2.0.1
2021-02-22 20:26 UTC
Requires
- php: >=7.4
Requires (Dev)
- qlimix/code-standard: ^3.0
This package is auto-updated.
Last update: 2024-10-23 04:54:16 UTC
README
A Uuid value object and an interface to generate an uuid.
Install
Using Composer:
$ composer require qlimix/uuid
usage
<?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 }
Testing
To run all unit tests locally with PHPUnit:
$ vendor/bin/phpunit
Quality
To ensure code quality run grumphp which will run all tools:
$ vendor/bin/grumphp run
Contributing
Please see CONTRIBUTING for details.