PHPackages                             insolita/yii2-arsync - 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. [Caching](/categories/caching)
4. /
5. insolita/yii2-arsync

ActiveYii2-extension[Caching](/categories/caching)

insolita/yii2-arsync
====================

This behavior for automatic or manual sync data between two models, without declaration relation. This behavior must be attached on master model. Main purposes - for sync rarely modified data from more reliable database storage to redis storage for frequently access; Support actual data state in some development cases;

0.0.1(10y ago)130MITPHP

Since May 12Pushed 10y ago1 watchersCompare

[ Source](https://github.com/Insolita/yii2-arsync)[ Packagist](https://packagist.org/packages/insolita/yii2-arsync)[ RSS](/packages/insolita-yii2-arsync/feed)WikiDiscussions master Synced 4w ago

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

ActiveRecord Synchronization Behavior
=====================================

[](#activerecord-synchronization-behavior)

This behavior for automatic or manual sync data between two models, without declaration relation. This behavior must be attached on master model. Main purposes - for sync rarely modified data from more reliable database storage to redis storage for frequently access; Support actual data state in some development cases;

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist insolita/yii2-arsync "*"

```

or add

```
"insolita/yii2-arsync": "*"

```

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

Usage
-----

[](#usage)

Once the extension is installed, simply use it in your code by : See more in code

```
public function behaviors(){
    return [
       'ArSyncBehavior'=>[
       				'class'      => ArSyncBehavior::class,
       				'slaveModel' => \your\model\namespase\Slave::className(),
       				'slaveScenario'=>'sync',
       				'errorSaveCallback'=>function($slave){
                          Yii::error(VarDumper::export($slave->errors));
                          throw new InvalidConfigException('fail save ');
                    },
                    'errorDeleteCallback'=>function($slave){
                        Yii::error('fail delete '.$slave->getPrimaryKey());
                     },
       				'fieldMap' => [
       					'id'=>'id',
       					'title' => 'name',
       					'foo'   => 'foo',
       					'bar'   => 'bar',
       					'baz'   => function($master)
       					{
       						return $master->baz * 2;
       					},
       				],
       			]
    ];
}
```

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3701d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/40f26825f8c130796e3151e6c076721cf5bb222c42148102bb31a341a1a5c789?d=identicon)[Insolita](/maintainers/Insolita)

---

Top Contributors

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

---

Tags

hacktoberfestredissynchronizationyii2extensionactiverecordsync

### Embed Badge

![Health badge](/badges/insolita-yii2-arsync/health.svg)

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

###  Alternatives

[bazilio/yii2-async

Provides translucent api for moving large tasks out of request context

6249.6k2](/packages/bazilio-yii2-async)[undefinedor/yii2-cached-active-record

The cached activeRecord for the Yii2 framework

102.6k](/packages/undefinedor-yii2-cached-active-record)

PHPackages © 2026

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