plugin-hook

Add Symfony EventDispatcher hooks to Plugin.php with matching test updates.

6|1|Updated Jun 8, 2017
One-click install
npx skills add https://github.com/myadmin-plugins/opensrs-domains --skill plugin-hook
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: plugin-hook
Source: https://github.com/myadmin-plugins/opensrs-domains/tree/main/.claude/skills/plugin-hook
Command: npx skills add https://github.com/myadmin-plugins/opensrs-domains --skill plugin-hook

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Adds a new Symfony EventDispatcher hook to the plugin to extend behavior without editing core files.

Core Features & Use Cases

  • Allows registering event handlers via getHooks() following the established naming conventions.
  • Ensures each hook has a matching public static method on Plugin and uses self::$module prefix for module-scoped events.
  • Helps maintain test coverage by updating test expectations when hooks are added.

Quick Start

Create a new public static handler in Plugin.php and register it in getHooks() following the established pattern.

Frequently Asked Questions about plugin-hook

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

FAQPage Schema
How do I add a Symfony EventDispatcher hook to a PHP plugin?

To add a Symfony EventDispatcher hook, you register the event handler via the getHooks() method and implement a corresponding public static method on the Plugin class using the correct event name.

What is the naming convention for module-scoped Symfony events in getHooks()?

Module-scoped Symfony events require the event handler to use the self::$module prefix. This ensures the registered hook properly maps to the correct module-specific event dispatcher scope.

Do I need to update tests when adding new Symfony event hooks?

Yes, you must update test expectations when adding new Symfony event hooks. The implementation enforces test alignment by requiring PluginTest hook counts and keys to match the newly registered events.

Can I extend plugin behavior without modifying core files using Symfony hooks?

Yes, adding Symfony EventDispatcher hooks allows you to extend plugin behavior without editing core files. You achieve this by defining new public static handlers in Plugin.php and registering them.

Why does my registered Symfony event hook not trigger in the plugin?

A registered Symfony event hook fails if the public static method on the Plugin class is missing or uses an incorrect event name. Module-scoped events also require the self::$module prefix to trigger correctly.