PHP code example of semiorbit / guid

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

    

semiorbit / guid example snippets


Guid::NewGuid(string $separator = '-', bool $enclose = true) : string

use SemiorbitGuid\Guid;

echo Guid::NewGuid();

// OUTPUT:
// {6BE33503-D448-0264-11AC-38822224B694}

Guid::Create(): string

use SemiorbitGuid\Guid;

echo Guid::Create();

// OUTPUT:
// 53FED73BF73C7D4C720DD8EE8DAB8B2B
 
Guid::Format(string $guid, bool $enclose = true, string $separator = '-'): string

use SemiorbitGuid\Guid;

$guid = '4F93820EFEF290A26489E0AE803A37C0';

echo Guid::Format($guid);

// OUTPUT:
// {4F93820E-FEF2-90A2-6489-E0AE803A37C0}