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.6k↑20%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 3d 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

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

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://avatars.githubusercontent.com/u/7480673?v=4)[Egor](/maintainers/kozhemin)[@kozhemin](https://github.com/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

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M118](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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