PHP code example of limanweb / uuid

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

    

limanweb / uuid example snippets


$uuid = \Limanweb\Uuid\Support\Uuid::genUuid(256, 16);
echo $uuid; // "5ec004c4-0db2-0010-0100-a08cc1dd9a2b"

$uuid = "5ec004c4-0db2-0010-0100-a08cc1dd9a2b";

$ts = \Limanweb\Uuid\Support\Uuid::getUuidTimestamp($uuid, "Y-m-d H:i:s.u");

echo $ts; // "2020-05-16 18:20:36.056096"	

$uuid = "5ec004c4-0db2-0010-0100-a08cc1dd9a2b";

$appCode = \Limanweb\Uuid\Support\Uuid::getUuidAppCode($uuid);
echo $appCode; // 16

$uuid = "5ec004c4-0db2-0010-0100-a08cc1dd9a2b";

$appCode = \Limanweb\Uuid\Support\Uuid::getUuidAppCode($uuid);
echo $appCode; // 256

class MyModel extends Model
{
	use \Limanweb\Uuid\Models\Concerns\UsesUuids;
	
	protected $appCode = 16;	// 010
	protected $entityCode = 256;	// 0100
	
	...