PHPackages                             mongosoft/yii2-mongodate-behavior - 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. mongosoft/yii2-mongodate-behavior

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

mongosoft/yii2-mongodate-behavior
=================================

MongoDate behavior for Yii 2

0.2.0(9y ago)7127.2k↓15.6%11BSD 3-ClausePHPPHP &gt;=5.4.0

Since Nov 29Pushed 9y ago1 watchersCompare

[ Source](https://github.com/mohorev/yii2-mongodate-behavior)[ Packagist](https://packagist.org/packages/mongosoft/yii2-mongodate-behavior)[ Docs](https://github.com/mongosoft/yii2-mongodate-behavior)[ RSS](/packages/mongosoft-yii2-mongodate-behavior/feed)WikiDiscussions master Synced 1mo ago

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

MongoDate behavior for Yii 2
============================

[](#mongodate-behavior-for-yii-2)

MongoDateBehavior automatically fills the specified attributes with the current ISODate.

By default, MongoDateBehavior will fill the `created` and `updated` attributes with the current ISODate when the associated AR object is being inserted; it will fill the `updated` attribute with the ISODate when the AR object is being updated.

[![Latest Stable Version](https://camo.githubusercontent.com/cca179e224e55e9d1acc183aa7ef8b212071253cc16bacff6708b9a92438e452/68747470733a2f2f706f7365722e707567782e6f72672f6d6f6e676f736f66742f796969322d6d6f6e676f646174652d6265686176696f722f762f737461626c652e706e67)](https://packagist.org/packages/mongosoft/yii2-mongodate-behavior)[![Total Downloads](https://camo.githubusercontent.com/1df272f28e8e2962648a0da0087c2dedbab3cf92a0c3613f3b28e20108b21b92/68747470733a2f2f706f7365722e707567782e6f72672f6d6f6e676f736f66742f796969322d6d6f6e676f646174652d6265686176696f722f646f776e6c6f6164732e706e67)](https://packagist.org/packages/mongosoft/yii2-mongodate-behavior)

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist mongosoft/yii2-mongodate-behavior "*"

```

or add

```
"mongosoft/yii2-mongodate-behavior": "*"
```

to the `require` section of your `composer.json` file.

Usage
-----

[](#usage)

### Upload file

[](#upload-file)

Attach the behavior in your model:

```
class User extends ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function collectionName()
    {
        return 'user';
    }

    /**
     * @inheritdoc
     */
    public function attributes()
    {
        return [
            '_id', 'name', 'created', 'updated',
        ];
    }

    /**
     * @inheritdoc
     */
    function behaviors()
    {
        return [
            MongoDateBehavior::className(),
        ];
    }
}
```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~586 days

Total

2

Last Release

3602d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4974062?v=4)[Alexander Mohorev](/maintainers/mohorev)[@mohorev](https://github.com/mohorev)

---

Top Contributors

[![mohorev](https://avatars.githubusercontent.com/u/4974062?v=4)](https://github.com/mohorev "mohorev (7 commits)")[![ApexWire](https://avatars.githubusercontent.com/u/2697129?v=4)](https://github.com/ApexWire "ApexWire (2 commits)")

---

Tags

mongodbyii2extensionBehaviormongodate

### Embed Badge

![Health badge](/badges/mongosoft-yii2-mongodate-behavior/health.svg)

```
[![Health](https://phpackages.com/badges/mongosoft-yii2-mongodate-behavior/health.svg)](https://phpackages.com/packages/mongosoft-yii2-mongodate-behavior)
```

###  Alternatives

[sjaakp/yii2-sortable-behavior

Sort ActiveRecords and related records in Yii2.

36144.7k](/packages/sjaakp-yii2-sortable-behavior)[nanson/yii2-postgis

Yii2-extension to work with postgis data

1851.6k](/packages/nanson-yii2-postgis)[dmstr/yii2-db

Database extensions

19618.8k6](/packages/dmstr-yii2-db)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
