PHPackages                             kozhemin/yii2-insert-update-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. kozhemin/yii2-insert-update-behavior

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

kozhemin/yii2-insert-update-behavior
====================================

Simple Behavior INSERT ON DUPLICATE KEY UPDATE or INSERT IGNORE

115.2k↓33.3%1PHP

Since May 1Pushed 9y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Yii2 Insert Update Behavior
===========================

[](#yii2-insert-update-behavior)

Simple Behavior INSERT ON DUPLICATE KEY UPDATE or INSERT IGNORE

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

[](#installation)

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

Either run

```
php composer.phar require kozhemin/yii2-insert-update-behavior:dev-master

```

or add

```
"kozhemin/yii2-insert-update-behavior": "dev-master"

```

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

Usage
-----

[](#usage)

This behavior allows you to create queries for INSERT ON DUPLICATE KEY UPDATE or INSERT IGNORE

For example:

Attach a new behavior to your model

```
   public function behaviors()
   {
       return[
            \kozhemin\dbHelper\InsertUpdate::className(),
       ];
   }
```

usage

```
   $dataInsert = [ ['title text', 'description'], ['title2 text', 'description2'], ['title3 text', 'descriptio3'] ];
   //Optional column parameter
   $column = ['title', 'description'];
```

```
    //INSERT ON DUPLICATE KEY UPDATE
    $model = new Post();
    $model->InsertUpdate($dataInsert, $column)
```

or

```
    //INSERT IGNORE
    $model = new Post();
    $model->insertIgnore($dataInsert, $column)
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community8

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/d2f80cad342d6145adcd3b68e6cfb2fb10fbba6b6ca000ea9b04e0190ce26abc?d=identicon)[kozhemin](/maintainers/kozhemin)

---

Top Contributors

[![kozhemin](https://avatars.githubusercontent.com/u/7480673?v=4)](https://github.com/kozhemin "kozhemin (3 commits)")

### Embed Badge

![Health badge](/badges/kozhemin-yii2-insert-update-behavior/health.svg)

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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