events

Guide Symfony-based event dispatching and subscriber registration for OrangeHRM plugins.

1.1k|746|Updated Jan 5, 2017
One-click install
npx skills add https://github.com/orangehrm/orangehrm --skill events-orangehrm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: events
Source: https://github.com/orangehrm/orangehrm/tree/main/.agents/skills/events
Command: npx skills add https://github.com/orangehrm/orangehrm --skill events-orangehrm

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates the common frustration of working with OrangeHRM's Symfony-based event system, which requires explicit subscriber registration, strict case-sensitive event naming, and manual priority management that often leads to silent, hard-to-debug failures for new contributors.

Core Features & Use Cases

  • Custom Event Creation & Dispatching: Define domain-specific events (like EmployeeSavedEvent or LeaveApply) with immutable payload carriers, and dispatch them from service classes to decouple business logic across plugins.
  • Subscriber Development & Registration: Write class-based subscribers that react to events, register them correctly in plugin configuration during boot, and use priority ordering to control execution flow between multiple listeners.
  • Event Debugging & Framework Integration: Troubleshoot common issues like non-firing listeners, hook into Symfony KernelEvents for request/response/exception handling, and follow the same patterns used by OrangeHRM's core auth and mailer subscribers.
  • Use Case: For example, build a custom plugin that triggers a Slack notification every time a leave request is approved by following the event dispatching and subscriber registration steps outlined in this Skill.

Quick Start

Use the events skill to write and register a subscriber that sends an alert when a new employee is added to the OrangeHRM system.

Frequently Asked Questions about events

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I register Symfony event subscribers in an OrangeHRM plugin?

To register Symfony event subscribers in an OrangeHRM plugin, you must explicitly register your class-based subscribers during the plugin initialization boot phase to ensure they react to dispatched events correctly.

Why does my OrangeHRM event subscriber listener not fire?

Your OrangeHRM event subscriber likely fails to fire due to strict case-sensitive event naming or missing explicit subscriber registration during plugin boot, which causes silent failures in the event dispatching system.

How do I control execution order between multiple event subscribers in OrangeHRM?

You control event subscriber execution order in OrangeHRM by manually assigning priority values to each listener, which dictates the sequence they are triggered when multiple subscribers react to the same dispatched event.

Can I hook into Symfony KernelEvents for request and exception handling in OrangeHRM plugins?

Yes, you can hook into Symfony KernelEvents within OrangeHRM plugins to manage request, response, and exception handling by following the same event subscriber patterns used by OrangeHRM's core authentication and mailer systems.

What is the correct way to structure custom domain events in OrangeHRM?

The correct way to structure custom domain events in OrangeHRM is by implementing immutable payload carrier classes that adhere to OrangeHRM's strict event naming conventions, ensuring decoupled business logic across plugins.

When should I stop event propagation in an OrangeHRM event subscriber?

You should apply event propagation control in an OrangeHRM subscriber only when you need to completely halt event handling, preventing any remaining listeners with lower priority from executing after your subscriber processes the event.