Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Entity Changes Fetcher

Entity Changes Fetcher Laravel Package

daimos/entity-changes-fetcher

Small PHP service that detects and reports changes made to an entity by comparing values before and after updates. Useful for auditing, logging, change tracking, and syncing—returns a structured list of modified fields and their old/new values.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Entity Changes Fetcher
How do I install **entity-changes-fetcher** in a Laravel project?
Run `composer require daimos/entity-changes-fetcher` to install. The package has no additional setup requirements beyond Composer autoloading. Ensure your Laravel version is 8+ (PHP 7.4+) for compatibility, as the package assumes Eloquent integration.
Can this package track changes for soft-deleted Eloquent models?
No, the package does not natively support soft deletes. If you need change tracking for soft-deleted models, you’ll need to manually trigger the fetcher before the `deleted` event or extend the library to handle soft deletes via custom logic.
What’s the best way to integrate this into my Laravel app without performance overhead?
Use model observers to attach the fetcher only to critical models (e.g., `User`, `Order`). For example, register an observer in `AppServiceProvider` and call `EntityChangesFetcher::getChanges()` in the `saving` or `updated` hooks. Avoid global middleware to prevent unnecessary diff calculations.
Does this package work with Laravel’s built-in events (e.g., `ModelSaved`)?
No, the package doesn’t natively dispatch Laravel events, but you can manually trigger them after fetching changes. For example, emit a custom `EntityChanged` event in your observer to integrate with Laravel’s event system or listeners.
How do I ignore specific fields (e.g., timestamps, sensitive data) from change tracking?
The package likely supports configuration via a service provider or helper method. Check for options like `ignoredAttributes` or pass a whitelist/blacklist array to `getChanges()`. If undocumented, extend the library by overriding its default behavior in a service provider.
What Laravel versions and PHP versions does this package support?
The package assumes Laravel 8+ (PHP 7.4+) based on Eloquent’s modern features. Test thoroughly if using older versions, as compatibility isn’t explicitly stated. PHP 8.0+ may introduce breaking changes if the package uses deprecated features.
Can I store the diffs in a database table or Elasticsearch instead of logging them directly?
Yes, the package returns structured diffs (old/new values) that you can manually persist. Use Eloquent events or observers to save diffs to a `changes_log` table or push them to Elasticsearch via a custom service. The library itself doesn’t include storage backends.
What are the alternatives to **entity-changes-fetcher** for Laravel audit logging?
Consider `spatie/laravel-activitylog` for full audit trails with user context, or `owen-it/laravel-auditing` for model-level tracking. For lightweight needs, combine Laravel’s `updated_at` with custom logging. Database triggers or PostgreSQL’s `jsonb` diffs are also options if you’re using advanced DB features.
How do I test this package in my Laravel application?
Mock Eloquent models in PHPUnit tests and verify diffs using assertions. For example, test `getChanges()` with a model before/after updates. Since the package lacks built-in tests, validate edge cases like nested attributes, mass assignments, or relationship changes manually.
Is this package suitable for production use, or should I wait for more adoption?
Proceed with caution—this package has no stars, minimal documentation, and no tests, indicating unproven production stability. Start with a pilot on non-critical models and monitor performance. If audit compliance is critical, consider more mature alternatives like `spatie/laravel-activitylog`.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope