1. Go to this page and download the library: Download fab2s/souuid 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/ */
/**
* @throws \Exception
*
* @return string
*/
public static function generateSoUuid(): string
{
// base62 example, could be any of the available forms
return SoUuid::generate(static::generateSoUuidIdentifier())->getBase62();
}
// Raw binary form
$table->char('id', 16)->charset('ascii')->collation('ascii_bin')->primary();
// base62 unpaded, valid until 2398-12-22 05:49:06 UTC
$table->char('id', 21)->charset('ascii')->collation('ascii_bin')->primary();
// base36 unpaded, valid until 2085-11-09 15:34:00 UTC
$table->char('id', 24)->charset('ascii')->collation('ascii_bin')->primary();
// string form, valid until 4253-05-31 22:20:37 UTC
$table->char('id', 36)->charset('ascii')->collation('ascii_bin')->primary();
$timeParts = explode(' ', microtime(false));
/*
[
"0.30693800", // there seems to always be two extra 0 after the µs
"1517993957",
]
*/
$timeMicroSec = $timeParts[1] . substr($timeParts[0], 2, 6); // 1517993957306938
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.