PHPackages                             msaddamkamal/model-dependency-sync - 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. msaddamkamal/model-dependency-sync

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

msaddamkamal/model-dependency-sync
==================================

A Laravel package to sync model dependencies and provide insights on updates.

0.1.2(2y ago)11.7kMITPHPPHP ^7.4|^8.0|^8.1

Since Mar 14Pushed 2y ago1 watchersCompare

[ Source](https://github.com/MSaddamKamal/model-dependency-sync)[ Packagist](https://packagist.org/packages/msaddamkamal/model-dependency-sync)[ RSS](/packages/msaddamkamal-model-dependency-sync/feed)WikiDiscussions main Synced yesterday

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

Model Dependency Sync for Laravel
=================================

[](#model-dependency-sync-for-laravel)

A Laravel package designed to sync model dependencies and provide insights on updates, making it easier to manage complex data relationships within your Laravel applications.

Features
--------

[](#features)

- Automatically sync related model data on updates.
- Provides insights into how model updates affect related data.
- Easy configuration and customization through a published template file.

Requirements
------------

[](#requirements)

- PHP version 7.4 or higher.
- Laravel 8.0 or higher.

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

[](#installation)

You can install the package via Composer:

```
composer require msaddamkamal/model-dependency-sync
```

This package uses Laravel's auto-discovery feature, so the service provider and facade will automatically be registered.

Customizing Model Behavior
--------------------------

[](#customizing-model-behavior)

This package allows you to define custom behavior for how your models' updates affect other parts of your application. To customize this behavior:

### Publish the Customization Template

[](#publish-the-customization-template)

Run the following command to publish a template PHP file to your application's `app/` directory:

```
 php artisan vendor:publish --tag=model-dependency-sync
```

### Customize Your Model Dependencies

[](#customize-your-model-dependencies)

After publishing, you'll find a new file `named model_dependencies.php` in your `app/` directory.Here, you can define how your models are related and what actions should be taken on updates.

```
return [
    // Example Model Class
    \App\Models\ExampleModel::class => [
        'listen' => ['field_to_listen_for_changes'],
        'affect' => [
            // Related Model Class
            \App\Models\RelatedModel::class => [
                'relation' => 'relationMethodOnExampleModel',
                'actions.field_to_listen_for_changes' => [
                    'update' => [
                        'related_model_field' => function ($exampleModelInstance, $relatedModelInstance) {
                            // Logic to handle the update
                            return $newFieldValue;
                        },
                    ],
                ],
            ],
        ],
    ],
];
```

This file allows you to specify which model attributes to "listen" for changes on, and define how those changes "affect" other models, including specifying custom actions to take using closures or other PHP logic.

Extending Functionality with a Custom Handler
---------------------------------------------

[](#extending-functionality-with-a-custom-handler)

If the default handling mechanism doesn't fully meet your requirements, you can extend the package's functionality by specifying a custom handler class in the configuration file. Your custom handler class should extend the package's base handler class `(MSaddamKamal\ModelDependencySync\BaseModelDependencyHandler)` and override necessary methods to implement your custom logic.

To use your custom handler, define it in the `config/model_dependencies.php` file like so:

```
return [
    'handler' => \App\Handlers\MyCustomModelDependencyHandler::class,
    // Other configuration...
];
```

### Publishing the Configuration

[](#publishing-the-configuration)

To publish the package configuration file to your application's config directory, run:

```
php artisan vendor:publish --tag=model-dependency-sync-config
```

Here's an example of what a custom handler might look like:

```
namespace App\Handlers;

use MSaddamKamal\ModelDependencySync\BaseModelDependencyHandler;

class MyCustomModelDependencyHandler extends BaseModelDependencyHandler
{
    public function handleModelUpdated($model)
    {
        // Your custom logic here
    }
}
```

By extending and defining a custom handler, you gain full control over how model updates are handled and can tailor the behavior to fit the specific needs of your application.

License
-------

[](#license)

The Model Dependency Sync for Laravel is open-sourced software licensed under the MIT license.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

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

Every ~0 days

Total

3

Last Release

840d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/75113661?v=4)[Saddy](/maintainers/MSaddamKamal)[@MSaddamKamal](https://github.com/MSaddamKamal)

### Embed Badge

![Health badge](/badges/msaddamkamal-model-dependency-sync/health.svg)

```
[![Health](https://phpackages.com/badges/msaddamkamal-model-dependency-sync/health.svg)](https://phpackages.com/packages/msaddamkamal-model-dependency-sync)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M345](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M11](/packages/renatomarinho-laravel-page-speed)[illuminate/pagination

The Illuminate Pagination package.

12234.1M1.0k](/packages/illuminate-pagination)[illuminate/pipeline

The Illuminate Pipeline package.

9349.2M282](/packages/illuminate-pipeline)[illuminate/redis

The Illuminate Redis package.

8314.6M375](/packages/illuminate-redis)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)

PHPackages © 2026

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