PHP code example of xihrni / yii2-behavior-time

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

    

xihrni / yii2-behavior-time example snippets




namespace app\models;

use xihrni\yii2\behaviors\TimeBehavior;

class Article extends \yii\db\ActiveRecord
{
    public static function tableName()
    {
        return '{{%article}}';
    }

    public function behaviors()
    {
        return array_merge(parent::behaviors(), [
            'time' => [
                'class' => TimeBehavior::className(),
            ],
        ]);
    }
}