PHPackages                             xihrni/yii2-behavior-time - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. xihrni/yii2-behavior-time

ActiveYii2-extension[Database &amp; ORM](/categories/database)

xihrni/yii2-behavior-time
=========================

For automatic updating of database table creation, update, and delete fields in the model.

0.0.2(6y ago)11342BSD-3-ClausePHP

Since May 5Pushed 6y ago2 watchersCompare

[ Source](https://github.com/xihrni/yii2-behavior-time)[ Packagist](https://packagist.org/packages/xihrni/yii2-behavior-time)[ RSS](/packages/xihrni-yii2-behavior-time/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (1)Versions (3)Used By (2)

Yii2 时间行为
=========

[](#yii2-时间行为)

Introduction
------------

[](#introduction)

用于自动更新模型中数据库表的创建、更新和删除字段

Install
-------

[](#install)

```
$ composer require xihrni/yii2-behavior-time

```

Demo
----

[](#demo)

```
CREATE TABLE `xi_article` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(255) NOT NULL DEFAULT '',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
```

```
