1. Go to this page and download the library: Download aracoool/yii2-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/ */
aracoool / yii2-uuid example snippets
use \aracoool\yii2-uuid\UuidBehavior
/**
* @return array
*/
public function behaviors()
{
return [
[
'class' => UuidBehavior::class,
'version' => Uuid::V4
],
...
];
}
use \aracoool\yii2-uuid\UuidBehavior
/**
* @return array
*/
public function behaviors()
{
return [
[
'class' => UuidBehavior::class,
'version' => Uuid::V3, // Uuid::V5
'namespace' => Uuid::NAMESPACE_NIL,
'nameAttribute' => 'title' // Value of this attribute SHOULD be unique in your database
],
...
];
}