PHP code example of yamaneyuta / ulid

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

    

yamaneyuta / ulid example snippets


use function yamaneyuta\ulid;

echo ulid(); // 01HVTDK9CSD1F58S8YGK6M610X

use yamaneyuta\Ulid;

echo (string)new Ulid(); // 01HVNE93FHMTQ38NSJ81M03H1Y

use yamaneyuta\Ulid;

$ulid = new Ulid();

// UUIDのフォーマットで出力
echo $ulid->toUuid(); // 018eeae8-64fd-06c9-19b6-3138fd763df8

// 16進数のフォーマットで出力
echo $ulid->toHex();  // 018eeae864fd06c919b63138fd763df8