PHPackages                             folkpro/yii2-many-has-many-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. folkpro/yii2-many-has-many-behaviors

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

folkpro/yii2-many-has-many-behaviors
====================================

Yii2 behavior

026PHP

Since Nov 10Pushed 10y ago1 watchersCompare

[ Source](https://github.com/folkpro/yii2-many-has-many-behaviors)[ Packagist](https://packagist.org/packages/folkpro/yii2-many-has-many-behaviors)[ RSS](/packages/folkpro-yii2-many-has-many-behaviors/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Yii2 ManyHasManyBehavior
========================

[](#yii2-manyhasmanybehavior)

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

[](#installation)

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

Either run

```
composer require folkpro/yii2-many-has-many-behaviors

```

or add

```
"folkpro/yii2-many-has-many-behaviors" : "*"
```

to the require section of your application's `composer.json` file.

Usage
-----

[](#usage)

- In your model, add the behavior and configure it

```
public function behaviors()
{
    return [
        [
            'class' => \folkpro\manyhasmanybehaviors\ManyHasManyBehavior::className(),
            'relations' => [
                 'tags' => 'tag_items',
             ],
        ],
    ];
}
```

- In your model, add the relation, for example:

```
public function getTags()
{
    return $this->hasMany(Tag::className(), ['id' => 'tag_id'])
        ->viaTable('post_has_tag', ['post_id' => 'id']);
}
```

- In your model, add validation rules for the attributes created by the behavior, for example:

```
public function rules()
{
    return [
        [['tag_list'], 'safe']
    ];
}
```

- In your view, create form fields for the attributes

---

*More information here:*
[ManyHasManyBehavior](http://fancode.ru/post/yii2-behaviors-many-to-many "Поведение Yii2 Behaviors для сохранения связанных данных «многие ко многим»")

---

---

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

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

### Community

Maintainers

![](https://www.gravatar.com/avatar/36be80b212beb971135593a9b851d6216dd99258b14a9efa6454079cbf332b21?d=identicon)[folkpro](/maintainers/folkpro)

---

Top Contributors

[![folkpro](https://avatars.githubusercontent.com/u/8178921?v=4)](https://github.com/folkpro "folkpro (11 commits)")

### Embed Badge

![Health badge](/badges/folkpro-yii2-many-has-many-behaviors/health.svg)

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

###  Alternatives

[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k39.6M299](/packages/laravel-dusk)[nineinchnick/edatatables

Grid widget for the Yii Framework, wrapper for the DataTables jQuery plugin

173.2k](/packages/nineinchnick-edatatables)[link-cloud/fast-hyperf

LinkCloud Fast Hyperf

241.2k1](/packages/link-cloud-fast-hyperf)

PHPackages © 2026

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