PHP code example of eig / uuid

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

    

eig / uuid example snippets


use eig\UUID;

class Example {
    
    protected $id;
    
    public function __construct()
    {
        $this->id = UUID::generate();
    }
}

use eig\UUID\AssignUUID;

class Example
{
    use AssignUUID;

    /**
     * @var
     */
    protected $id;

    /**
     * Example constructor.
     */
    public function __construct ()
    {
        $this->assignUUID();
    }

    /**
     * getID
     * @return mixed
     */
    public function getID()
    {
        return $this->id;
    }
}

use eig\UUID\AssignUUID;

/**
 * Class AlternateFieldExample
 * @package eig\UUID
 * @license MIT
 * @author James Johnson
 * @author Excellent InGenuity LLC
 */
class AlternateFieldExample
{
    use AssignUUID;

    /**
     * @var
     */
    protected $alternateID;

    /**
     * AlternateFieldExample constructor.
     */
    public function __construct ()
    {
        $this->assignUUID('alternateID');
    }

    /**
     * getAlternateID
     * @return mixed
     */
    public function getAlternateID()
    {
        return $this->alternateID;
    }
}