Download the PHP package rdcstarr/superpower-events without Composer
On this page you can find all versions of the php package rdcstarr/superpower-events. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rdcstarr/superpower-events
More information about rdcstarr/superpower-events
Files in rdcstarr/superpower-events
Package superpower-events
Short Description Model lifecycle events architecture for Laravel: 6 generic events + 6 listener traits, dispatched automatically via reflection on handleModel().
License MIT
Informations about the package superpower-events
superpower-events
Model lifecycle events architecture for Laravel — six generic events (ModelCreating/Created/Updating/Updated/Deleting/Deleted) dispatched automatically by the DispatchesModelEvents trait, with companion listener traits that filter by model type via reflection on handleModel().
Install
Usage
1. Add the trait to your model
The trait boots automatically via bootDispatchesModelEvents() and registers Eloquent hooks for all six lifecycle events.
2. Create a listener using a companion trait
Available listener traits (one per lifecycle hook):
| Trait | Event fired |
|---|---|
Concerns\ModelCreating |
before INSERT |
Concerns\ModelCreated |
after INSERT |
Concerns\ModelUpdating |
before UPDATE |
Concerns\ModelUpdated |
after UPDATE |
Concerns\ModelDeleting |
before DELETE |
Concerns\ModelDeleted |
after DELETE |
Each trait provides a typed handle(EventClass $event) method that filters by the model type declared on your handleModel() parameter. No manual instanceof check, no $listen array — Laravel 11+ auto-discovers the listener from the typed handle() signature.
3. Pre-save mutations
Pre-save listeners (ModelCreating / ModelUpdating / ModelDeleting) receive the model before the write — mutations applied inside handleModel() persist in the same INSERT/UPDATE:
Personal toolkit — no support guarantees.
All versions of superpower-events with dependencies
illuminate/contracts Version ^13.0
illuminate/database Version ^13.0
illuminate/events Version ^13.0
illuminate/queue Version ^13.0
illuminate/support Version ^13.0
spatie/laravel-package-tools Version ^1.16