PHPackages                             beco/yii-common - 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. beco/yii-common

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

beco/yii-common
===============

Common Yii2 base ActiveRecord and helpers

0.1.10(5mo ago)0126MITPHPPHP &gt;=8.0

Since Nov 21Pushed 5mo agoCompare

[ Source](https://github.com/beco/yii-common)[ Packagist](https://packagist.org/packages/beco/yii-common)[ RSS](/packages/beco-yii-common/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (11)Versions (9)Used By (0)

Common Stuff for Yii2 Projects
==============================

[](#common-stuff-for-yii2-projects)

Instalation
===========

[](#instalation)

`composer require beco/yii-common:dev-main`

Provides
--------

[](#provides)

- new project creator (beco flavored)
- `beco\yii\db\ActiveRecord`:
    - Human and Relative Dates automatic functions
- `beco\yii\models\User`: a basic user model (and its migration)
- `beco\yii\commands\SystemCommand`: a command for
- db backup
- system check

### Images

[](#images)

add the following line to `start.sh``./yii migrate --migrationPath=beco/yii/migrations/image --interactive=0`

### New project starter

[](#new-project-starter)

Moved to beco\\yii2-basic-template

### Human, DateTime and Relative functions

[](#human-datetime-and-relative-functions)

If you have a field which is a date or a datetime column in mysql, aka `yyyy-mm-dd` or `yyyy-mm-dd hh:ii:ss`, let's call it `starts_at`, by extending `beco\yii\db\ActiveRecord` you automatically have three new functions:

1. `$model->starts_atHuman`returns a nice print of the date as "jueves 2 de mayo del 2015 a las 12:34pm"
2. `$model->starts_atRelative` returns how much time is left for such date in a human way
3. `$model->starts_atDateTime` a `\DateTime` representation of such date

Automatically you also have `starts_atHuman` and `startsAtHuman`.

Info
====

[](#info)

Then, in order to get some local handling use intermediate classes:

```
