PHP code example of yu-ichiro / ulid

1. Go to this page and download the library: Download yu-ichiro/ulid 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/ */

    

yu-ichiro / ulid example snippets



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"