PHPackages                             dgoriaev/yii2-behaviors - 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. [Framework](/categories/framework)
4. /
5. dgoriaev/yii2-behaviors

ActiveYii2-extension[Framework](/categories/framework)

dgoriaev/yii2-behaviors
=======================

Collection of useful behaviors for Yii Framework 2.0. Fork for php &gt;= 8.0

2.0.0(1y ago)131MITPHPPHP ^7.4 || ^8.0

Since Oct 3Pushed 1y agoCompare

[ Source](https://github.com/DplusG/yii2-behaviors)[ Packagist](https://packagist.org/packages/dgoriaev/yii2-behaviors)[ RSS](/packages/dgoriaev-yii2-behaviors/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (2)Used By (1)

Yii2 behaviors
==============

[](#yii2-behaviors)

Collection of useful behaviors for Yii Framework 2.0

[![Latest Stable Version](https://camo.githubusercontent.com/47c17187c058f0b233ff989f4dea25323d0259b6ba6c5e13b78e9a4d30d76c3a/68747470733a2f2f706f7365722e707567782e6f72672f796969326d6f642f796969322d6265686176696f72732f762f737461626c65)](https://packagist.org/packages/yii2mod/yii2-behaviors) [![Total Downloads](https://camo.githubusercontent.com/849a14c74acaf0c9c093575fc020ae9e282621afb542eee49b78015f9d1ac74a/68747470733a2f2f706f7365722e707567782e6f72672f796969326d6f642f796969322d6265686176696f72732f646f776e6c6f616473)](https://packagist.org/packages/yii2mod/yii2-behaviors) [![License](https://camo.githubusercontent.com/c5a57be71611b9b763c18f767f66f88f204d9bcf49371d8b80d00563609e2730/68747470733a2f2f706f7365722e707567782e6f72672f796969326d6f642f796969322d6265686176696f72732f6c6963656e7365)](https://packagist.org/packages/yii2mod/yii2-behaviors)[![Build Status](https://camo.githubusercontent.com/1e0a2ba14b9038787139aadb3c42f17ea2cdf495e723771496414c26303ad6f2/68747470733a2f2f7472617669732d63692e6f72672f796969326d6f642f796969322d6265686176696f72732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/yii2mod/yii2-behaviors)

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist yii2mod/yii2-behaviors "*"

```

or add

```
"yii2mod/yii2-behaviors": "*"

```

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

Usage
-----

[](#usage)

1. **PurifyBehavior**

```
    public function behaviors()
    {
        return [
            'purify' => [
                'class' => PurifyBehavior::className(),
                'attributes' => ['title', 'content'],
                'config' => [
                    'AutoFormat.Linkify' => true,
                    'HTML.TargetBlank' => true,
                    'HTML.Nofollow' => true
                ]
            ]
        ];
    }
```

2. **CarbonBehavior**

> CarbonBehavior automatically creates a Carbon Instance for one or multiple attributes of an ActiveRecord object when `afterFind` event happen.

```
    public function behaviors()
    {
            return [
                'carbon' => [
                    'class' => CarbonBehavior::className(),
                    'attributes' => [
                        'createdAt',
                        'trialEndAt',
                    ]
                ],
            ];
     }

      $user = UserModel::findOne(1);

      var_dump($user->createdAt->year); // 2016
      var_dump($user->createdAt->month); // 5
      var_dump($user->createdAt->day); // 10

      // change date

      $user->trialEndAt->addYear();
      $user->save();
```

> [Carbon Documentation](http://carbon.nesbot.com/docs/#api-introduction)

Support us
----------

[](#support-us)

Does your business depend on our contributions? Reach out and support us on [Patreon](https://www.patreon.com/yii2mod). All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% 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

Unknown

Total

1

Last Release

586d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/efbd82d55cd5e0c7e3c111c29897692edc43f840f9aa2b7b0f16c5f66978989d?d=identicon)[DplusG](/maintainers/DplusG)

---

Top Contributors

[![acorncom](https://avatars.githubusercontent.com/u/802505?v=4)](https://github.com/acorncom "acorncom (4 commits)")[![dmitry-semenov](https://avatars.githubusercontent.com/u/17027799?v=4)](https://github.com/dmitry-semenov "dmitry-semenov (1 commits)")

---

Tags

yii2yii2 behaviors

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/dgoriaev-yii2-behaviors/health.svg)

```
[![Health](https://phpackages.com/badges/dgoriaev-yii2-behaviors/health.svg)](https://phpackages.com/packages/dgoriaev-yii2-behaviors)
```

###  Alternatives

[yii2mod/yii2-behaviors

Collection of useful behaviors for Yii Framework 2.0

31107.1k9](/packages/yii2mod-yii2-behaviors)[skeeks/cms

SkeekS CMS — control panel and tools based on php framework Yii2

13825.6k47](/packages/skeeks-cms)

PHPackages © 2026

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