Skip to content
A PHP port of alizain/ulid with some minor improvements.
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
benchmarks
src
tests
.gitattributes
.gitignore
.travis.yml
CHANGELOG.md
LICENSE
README.md
composer.json
phpbench.json
phpunit.xml.dist

README.md

Universally Unique Lexicographically Sortable Identifier

Latest Stable Version Build Status

A PHP port of ulid/javascript with some minor improvements.

Installation

You can install the package via Composer.

composer require robinvdvleuten/ulid

Usage

use Ulid\Ulid;

$ulid = Ulid::generate();
echo (string) $ulid; // 01B8KYR6G8BC61CE8R6K2T16HY

// Or if you prefer a lowercased output
$ulid = Ulid::generate(true);
echo (string) $ulid; // 01b8kyr6g8bc61ce8r6k2t16hy

// If you need the timestamp from an ULID instance
$ulid = Ulid::generate();
echo $ulid->toTimestamp(); // 1561622862

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

As it's just a simple port of JavaScript to PHP code. All credits should go to the original ULID specs.

License

The MIT License (MIT). Please see License File for more information.

You can’t perform that action at this time.