PHP code example of eve / uuid

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

    

eve / uuid example snippets


use Eve\Uuid\Uuid;

// Generate a UUID string
$uuid = Uuid::generate();

// The package also comes with a handy global function
$uuid = uuid();

// Freeze the next generated value, useful for testing
$frozenValue = Uuid::freeze();
assert(Uuid::generate() === $frozenValue); // true

// You can also supply a custom value for freezing
Uuid::freeze('dummy');
assert(Uuid::generate() === 'dummy'); // true

// "Reset" UUID generation to normal. This can for example be put in PHPUnit's `tearDown` method. 
Uuid::unfreeze();