PHP code example of nishadil / uuid

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

    

nishadil / uuid example snippets



Nishadil\Uuid\Uuid;

$uuidV1 = Uuid::v1()->get();

$uuidV2 = Uuid::v2()
    ->withLocalDomain('uid') // or 'gid'
    ->withLocalId(1000)
    ->get();

$uuidV3 = Uuid::v3()
    ->withNamespace('6ba7b810-9dad-11d1-80b4-00c04fd430c8')
    ->withName('www.example.com')
    ->get();

$uuidV4 = Uuid::v4()->get();

$uuidV5 = Uuid::v5()
    ->withNamespace('6ba7b810-9dad-11d1-80b4-00c04fd430c8')
    ->withName('www.example.com')
    ->get();

$uuidV6 = Uuid::v6()->get();

$uuidV7 = Uuid::v7()->get();

$uuidV8 = Uuid::v8()
    ->withCustomHex('00112233445566778899aabbccddeeff')
    ->get();