yu-ichiro / ulid
A simple and robust implementation of ULID in PHP
v1.0.0
2021-12-18 16:31 UTC
Requires
- php: ^8.0 || ^7.3
Requires (Dev)
- phpstan/phpstan: ^1.2
- phpunit/phpunit: ^9.5
- psy/psysh: ^0.11.0
- ramsey/uuid: ^4.2
- squizlabs/php_codesniffer: ^3.6
Suggests
- ramsey/uuid: This dependency will make Ulid::toUuid() compatible with Uuid
This package is not auto-updated.
Last update: 2024-11-18 05:04:08 UTC
README
A simple and robust implementation of ULID in PHP with no dependency.
Works on its own, but utilizes Ramsey\Uuid\Uuid if present.
Installation
$ composer require yu-ichiro/ulid
Usage
use Ulid\Ulid new Ulid(); // ULID {01FQ75VPEBGY1JZSRD03EMM5QM} new Ulid('01FQ75VPEBGY1JZSRD03EMM5QM'); // ULID {01FQ75VPEBGY1JZSRD03EMM5QM} new Ulid('017dce5d-d9cb-8783-2fe7-0d00dd4a16f4'); // ULID {01FQ75VPEBGY1JZSRD03EMM5QM} (string) new Ulid(); // "01FQ75VPEBGY1JZSRD03EMM5QM" (new Ulid())->jsonSerialize(); // "01FQ75VPEBGY1JZSRD03EMM5QM" (new Ulid())->toUuid(); // "017dce5d-d9cb-8783-2fe7-0d00dd4a16f4"