1. Go to this page and download the library: Download mpyw/uuid-ulid-converter library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mpyw / uuid-ulid-converter example snippets
public static Converter::uuidToUlid(string $uuid, bool $lowercase = false): string
public static Converter::ulidToUuid(string $ulid, bool $uppercase = false): string
use Mpyw\UuidUlidConverter\Converter;
var_dump(Converter::ulidToUuid('61862H2EWP9TCTRX3MJ15XNY7X'));
// string(36) "c1418511-3b96-4e99-ac74-74904bdaf8fd"
var_dump(Converter::uuidToUlid('c1418511-3b96-4e99-ac74-74904bdaf8fd'));
// string(26) "61862H2EWP9TCTRX3MJ15XNY7X"
use Mpyw\UuidUlidConverter\Converter;
use Ulid\Ulid;
// Use generated UUID as primary key
$uuid = Converter::ulidToUuid((string)Ulid::generate());