Download the PHP package kettasoft/booter without Composer
On this page you can find all versions of the php package kettasoft/booter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kettasoft/booter
More information about kettasoft/booter
Files in kettasoft/booter
Package booter
Short Description The Laravel Model Event Booter package provides a flexible way to organize and manage model event handling in Laravel applications. It allows developers to define specific actions for model events (such as created, updated, deleted, etc.) by associating them with custom classes. The package simplifies the process of executing logic for model events and makes it easy to extend and maintain event-driven behavior.
License MIT
Informations about the package booter
Laravel Model Event Booter
Laravel Model Event Booter is a package that simplifies managing model events in Laravel by allowing you to define and map model events (e.g., created
, updated
, deleted
, etc.) to custom classes. These classes handle the logic associated with those events, making your code cleaner, modular, and easier to maintain.
Features
- Automatically boot and trigger model events with custom logic.
- Organize event-specific logic into separate, reusable classes.
- Works with Laravel's built-in model events (
created
,updated
,deleted
, etc.). - Easy-to-use HasBooter trait that handles event firing.
Installation
-
- Install the package via Composer:
-
- Add the
HasBooter
trait to any model where you want to manage events.
- Add the
-
- Define the
$events
array in the model to map events to the classes that will handle them.
- Define the
-
- Publish the package's configuration file by running:
Usage
-
-
Add the
HasBooter
Trait to Your Model - Use the
HasBooter
trait in your model to enable event handling:
-
-
- Create Event Handler Classes Create a class for each event that you want to handle. Each class should have a handle method where you define the logic to run when the event is triggered.
The class defined in the event will be called automatically when the event occurs.
-
- Handle Multiple Events
You can define multiple events in the $events array for a single model. Each event can have one or more classes that will be triggered in sequence.
-
-
Event Handling Flow
- When the model event (like
created
,updated
, etc.) is triggered, the package automatically fires the associated class. - Each class must have a handle method where you implement the custom logic.
-
Contributing
Contributions are welcome! If you find any issues or have ideas for improvements, feel free to submit a pull request or open an issue.
License
This package is open-source software licensed under the MIT license.