chelout/laravel-relationship-events
Adds missing Eloquent relationship events to Laravel models. Use simple traits (HasOne/Many, BelongsTo/Many, Morph*) to listen for attach/detach/sync, saved/updated, and other relation lifecycle hooks with parent/related context and IDs/attributes.
Adopt When:
Look Elsewhere If:
spatie/laravel-queueable-events).For Executives: "This package lets us react instantly to changes in our data relationships—like sending alerts when a user updates their profile or syncing inventory when an order item is modified—without bloating our models. It’s like adding ‘triggers’ for Eloquent relationships, but cleaner and more scalable than custom code. We can use it to automate workflows, improve auditing, and reduce bugs in critical paths."
For Engineers:
*"This solves the ‘spaghetti event’ problem in Laravel. Instead of scattering logic across observers, model hooks, or service layers, we can centralize relationship events (e.g., hasOneSaved, morphToManyAttached) in listeners. It’s well-documented, supports all Laravel relationship types, and integrates with dispatchable events. For example, we can:
belongsTo association is updated.hasMany record is created.Key Selling Points:
How can I help you explore Laravel packages today?