jobmetric / laravel-event-system
This is a event system management package for Laravel that you can use in your projects.
Requires
- php: >=8.1
- jobmetric/laravel-package-core: ^1.23
- laravel/framework: >=9.19
This package is auto-updated.
Last update: 2025-08-12 19:23:19 UTC
README
Laravel Event System
Laravel Event System is a flexible and elegant package designed to simplify dynamic event management. It provides a layer on top of Laravel’s native event system, allowing for the registration and removal of events at runtime — perfect for modular applications and plugin-based systems.
📦 Installation
Install the package via Composer:
composer require jobmetric/laravel-event-system
Then publish the migration and run it:
php artisan migrate
⚙️ Configuration
The default configuration can be published using:
php artisan vendor:publish --tag=event-system-config
Config Options
return [ "cache_time" => env("EVENT_SYSTEM_CACHE_TIME", 60), "cache_key" => env("EVENT_SYSTEM_CACHE_KEY", "event_system_cache"), "tables" => [ 'event' => 'events', ], ];
🚀 Usage
You can dynamically register or remove events at runtime using the helper functions:
Register an Event
addEventSystem('user.created', App\Events\UserCreated::class, App\Listeners\SendWelcomeEmail::class, 'Triggered when a new user registers');
Remove an Event
removeEventSystem('user.created');
🎧 System Events
The package also emits its own events:
Event | Description |
---|---|
EventSystemStoreEvent |
Dispatched after an event has been registered |
EventSystemDeletingEvent |
Dispatched before an event is removed |
EventSystemDeletedEvent |
Dispatched after an event has been removed |
Contributing
Thank you for considering contributing to the Laravel Event System! The contribution guide can be found in the CONTRIBUTING.md.
License
The MIT License (MIT). Please see License File for more information.