1. Go to this page and download the library: Download webpatser/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/ */
webpatser / uuid example snippets
use Webpatser\Uuid\Uuid;
// Generate UUIDs
$uuid4 = Uuid::v4(); // Random (recommended for general use)
$uuid7 = Uuid::v7(); // Time-ordered (recommended for databases)
$uuid1 = Uuid::generate(1); // Time-based with MAC address
$uuid3 = Uuid::generate(3, 'example.com', Uuid::NS_DNS); // Name-based (MD5)
$uuid5 = Uuid::generate(5, 'example.com', Uuid::NS_DNS); // Name-based (SHA-1)
$uuid6 = Uuid::generate(6); // Reordered time-based
$uuid8 = Uuid::generate(8); // Custom/vendor-specific
echo (string) $uuid4; // e.g., "550e8400-e29b-41d4-a716-446655440000"
// Import from SQL Server
$uuid = Uuid::importFromSqlServer('825B076B-44EC-E511-80DC-00155D0ABC54');
// Export to SQL Server format
$sqlGuid = $uuid->toSqlServer(); // String format
$sqlBin = $uuid->toSqlServerBinary(); // 16-byte binary