horat1us/yii2-uuid-behavior 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

horat1us/yii2-uuid-behavior

最新稳定版本:1.2.0

Composer 安装命令:

composer require horat1us/yii2-uuid-behavior

包简介

Yii2 UUID generation behavior

README 文档

README

Build Status codecov

Behavior to generate UUID values (mostly, for ActiveRecord primary key).

Installation

Using packagist.org:

composer require horat1us/yii2-uuid-behavior:^1.0

Usage

To generate UUID for primary key follow example:

<?php

namespace App;

use Horat1us\Yii\UuidBehavior;
use yii\db;

/**
* Class Record
 * @package App
 * 
 * @property string $uuid // primary key in database, without default value and auto-increment
 */
class Record extends db\ActiveRecord
{
    public function behaviors(): array {
        return [
            'uuid' => [
                'class' => UuidBehavior::class,    
            ],    
        ];
    }
}

in followed example uuid in active record will be filled with random UUIDv4 before inserting.

License

MIT

统计信息

  • 总下载量: 4.83k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-03-19