PHPackages                             hbliang/laravel-attributes-replication - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. hbliang/laravel-attributes-replication

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

hbliang/laravel-attributes-replication
======================================

Laravel Attributes Replication

223.3k↓42.3%PHP

Since Jan 26Pushed 3y ago1 watchersCompare

[ Source](https://github.com/hbliang/laravel-attributes-replication)[ Packagist](https://packagist.org/packages/hbliang/laravel-attributes-replication)[ RSS](/packages/hbliang-laravel-attributes-replication/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Sync Attributes between models
======================================

[](#laravel-sync-attributes-between-models)

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

[](#installation)

`composer require hbliang/laravel-attributes-replication`

Configuration
-------------

[](#configuration)

`php artisan vendor:publish --provider="Hbliang\AttributesReplication\ReplicationServiceProvider"`

Usage
-----

[](#usage)

companies

```
id - integer
name - string

```

users

```
id - integer
company_id - integer
company- string

```

```
use Hbliang\AttributesReplication\Contracts\AttributesReplicatable;
use Hbliang\AttributesReplication\Traits\HasAttributesReplication;
use Illuminate\Database\Eloquent\Model;

class Company extends Model implements AttributesReplicatable
{
    use HasAttributesReplication;
    protected $fillable = ['name'];

    public static function registerAttributesReplication()
    {
        self::addAttributesReplication()
            ->map([
                'name' => 'company_name',
            ])
            // or use extra
            // ->extra(function(Company $company) {
            //     return [
            //         'company_name' => $company->name,
            //     ];
            // })
            ->relation('users')
            ->event('saved');
    }

    public function users()
    {
        return $this->hasMany(User::class);
    }
}

class User extends Model implements AttributesReplicatable
{
    use HasAttributesReplication;
    protected $fillable = ['company_name'];

    public static function registerAttributesReplication()
    {
        self::addAttributesReplication()
            ->passive()
            ->map([
                'name' => 'company_name',
            ])
            ->relation('company')
            ->event('created');
    }

    public function company()
    {
        return $this->hasMany(Company::class);
    }
}
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity23

Early-stage or recently created project

 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/12814637?v=4)[Ben](/maintainers/hbliang)[@hbliang](https://github.com/hbliang)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/hbliang-laravel-attributes-replication/health.svg)

```
[![Health](https://phpackages.com/badges/hbliang-laravel-attributes-replication/health.svg)](https://phpackages.com/packages/hbliang-laravel-attributes-replication)
```

###  Alternatives

[nzedb/nzedb

A Usenet Indexer

6415.4k](/packages/nzedb-nzedb)

PHPackages © 2026

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