EventManagement
is a reusable PHP package for managing events in WordPress plugins. It provides a structured and object-oriented approach to handling events, making your plugin development more efficient and maintainable.
- Easy to integrate with WordPress plugins
- Object-oriented approach for clean and maintainable code
- PSR-4 autoloading
- Extendable through interfaces and abstract classes
- PHP 8.0 or higher
- Composer for managing dependencies
Install the package via Composer:
composer require wazfactor/event-manager
Here's a basic example of how to use the EventManagement package in your WordPress plugin:
use WazFactor\EventManager\EventManager;
use WazFactor\EventManager\EventManagerSubscriber;
// Initialize the Event Manager
$eventManager = new EventManager();
// Create a subscriber
$subscriber = new EventManagerSubscriber($eventManager);
// Add events and listeners
$subscriber->addEvent('event_name', function() {
// Event handling logic
});
// Dispatch the event
$eventManager->dispatch('event_name');
Creating Custom Subscribers:
// Implement your custom subscriber class
Removing Subscribers:
// Example of removing a subscriber
Contributions to the EventManagement package are welcome. Please ensure that your code adheres to the PSR-1/PSR-2 coding standards and includes tests for new features.
Include your licensing information here.
Frank Wazeter - Initial work - WazFactor
Special thanks to the WordPress community Anyone else you'd like to thank
For support, please open an issue on the GitHub repository or contact [email protected].