2017 © Pedro Peláez
 

yii2-extension yii2-datetime-behavior

Initiates database date columns as DateTime PHP classes.

image

davidhirtz/yii2-datetime-behavior

Initiates database date columns as DateTime PHP classes.

  • Thursday, February 1, 2018
  • by davidhirtz
  • Repository
  • 1 Watchers
  • 0 Stars
  • 118 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 1 Versions
  • 6 % Grown

The README.md

Yii2 DateTime Behavior

Initiates database date columns as DateTime PHP classes., (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require --prefer-dist davidhirtz/yii2-datetime-behavior "*"

or add, (*4)

"davidhirtz/yii2-datetime-behavior": "*"

to the require section of your composer.json file., (*5)

Usage

Once the extension is installed, simply use it in your code by adding it to your ActiveRecord behavior. If you don't set the attributes all "date" and "datetime" columns will be automatically selected., (*6)

use davidhirtz\yii\datetime\DateTimeBehavior;
public function behaviors()
{
    return [
        [
            'class'=>DateTimeBehavior::class,
            //'attributes'=>['custom_attribute', 'another_attribute'],
        ],
    ];
}

The Versions

01/02 2018

dev-master

9999999-dev

Initiates database date columns as DateTime PHP classes.

  Sources   Download

BSD-3-Clause

The Requires

 

by David Hirtz

extension yii2 datetime