PHPackages                             cornernote/yii2-linkall - 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. cornernote/yii2-linkall

ActiveYii2-extension

cornernote/yii2-linkall
=======================

Behavior to handle saving multiple many to many related records in Yii2.

1.0.0(10y ago)2596.1k↓40.3%7[1 issues](https://github.com/cornernote/yii2-linkall/issues)BSD-3-ClausePHP

Since Jun 20Pushed 8y ago5 watchersCompare

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

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Yii2 LinkAll
============

[](#yii2-linkall)

[![Latest Version](https://camo.githubusercontent.com/eaa4faf57935689fb202b1c6d6c6627add76cde6138defeb8b34f3c2181a6a9d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f636f726e65726e6f74652f796969322d6c696e6b616c6c2e7376673f7374796c653d666c61742d737175617265266c6162656c3d72656c65617365)](https://github.com/cornernote/yii2-linkall/tags)[![Software License](https://camo.githubusercontent.com/b60331a2084501dc07cf6d6964c0da58dd005d89c45cf3b28b4b22b60f5ec00f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4253442d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/3b4dcfbee5b3335167af87e39ff5183b325481fcb60e09b6ea625b0aacbf215a/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f726e65726e6f74652f796969322d6c696e6b616c6c2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/cornernote/yii2-linkall)[![Coverage Status](https://camo.githubusercontent.com/9cbd28356b8283b6d82de44cf46622d0d4a211f5a0ff3ce58c0d5757385d387b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f636f726e65726e6f74652f796969322d6c696e6b616c6c2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/cornernote/yii2-linkall/code-structure)[![Quality Score](https://camo.githubusercontent.com/e8d5577771d84b17f50e72a4f64ddcb934c37a91073d54a7f90f4840edf5651d/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f636f726e65726e6f74652f796969322d6c696e6b616c6c2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/cornernote/yii2-linkall)[![Total Downloads](https://camo.githubusercontent.com/d4f90ad8fcec0634aece726e07cc8c511fa7c1a22260d22d9bde7c2ddc090c94/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f726e65726e6f74652f796969322d6c696e6b616c6c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cornernote/yii2-linkall)

Behavior to handle saving multiple many to many related records in Yii2.

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

[](#installation)

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

Either run

```
$ composer require cornernote/yii2-linkall "*"

```

or add

```
"cornernote/yii2-linkall": "*"

```

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

Usage
-----

[](#usage)

Post Model

```
class Post extends ActiveRecord
{
    public function behaviors()
    {
        return [
            \cornernote\linkall\LinkAllBehavior::className(),
        ];
    }

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

Tag Model

```
class Tag extends ActiveRecord
{

}
```

Post Controller

```
class PostController extends Controller
{
    public function actionExample()
    {
        $post = Post::findOne(1);
        $tags = [Tag::findOne(2), Tag::findOne(3)];

        $extraColumns = []; // extra columns to be saved to the many to many table
        $unlink = true; // unlink tags not in the list
        $delete = true; // delete unlinked tags

        $post->linkAll('tags', $tags, $extraColumns, $unlink, $delete);
    }
}
```

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community12

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3985d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/07c84a589344489e8195ec1c6afcfa3abcc23a73092ceaa4ca60da96355c4d16?d=identicon)[cornernote](/maintainers/cornernote)

---

Top Contributors

[![cornernote](https://avatars.githubusercontent.com/u/51875?v=4)](https://github.com/cornernote "cornernote (30 commits)")

---

Tags

linkyii2many to manylinkall

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cornernote-yii2-linkall/health.svg)

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

###  Alternatives

[voskobovich/yii2-many-many-behavior

This behavior makes it easy to maintain relations many-to-many in the your ActiveRecord model.

112181.9k2](/packages/voskobovich-yii2-many-many-behavior)[voskobovich/yii2-linker-behavior

This behavior makes it easy to maintain many-to-many and one-to-many relations in your ActiveRecord models.

80319.0k9](/packages/voskobovich-yii2-linker-behavior)[arogachev/yii2-many-to-many

Many-to-many ActiveRecord relation for Yii 2 framework

3541.2k4](/packages/arogachev-yii2-many-to-many)

PHPackages © 2026

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