edutrul/drupal-ai59 installs
drupal-events
Drupal event subscribers — Symfony events (PSR-14), KernelEvents, services.yml tags, and hooks vs events decision guide.
How do I install this agent skill?
npx skills add https://github.com/edutrul/drupal-ai --skill drupal-eventsIs this agent skill safe to install?
- Gen Agent Trust Hubpass
No security issues were detected. The skill provides standard documentation and code examples for Drupal event subscribers and follows development best practices.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
What does this agent skill do?
Drupal Event Subscribers
Example (Best Practice)
// src/EventSubscriber/MyEventSubscriber.php
namespace Drupal\my_module\EventSubscriber;
use Drupal\Core\Session\AccountProxyInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\KernelEvents;
final class MyEventSubscriber implements EventSubscriberInterface {
public function __construct(
private readonly AccountProxyInterface $currentUser,
) {}
public static function getSubscribedEvents(): array {
return [
// Note: Higher priority runs earlier. Default is 0.
KernelEvents::REQUEST => ['onRequest', 100],
];
}
public function onRequest(RequestEvent $event): void {
if (!$event->isMainRequest()) {
return;
}
if (!$this->currentUser->isAuthenticated()) {
return;
}
// Example: log or modify behavior for authenticated users.
}
}
Register in services.yml
services:
my_module.my_event_subscriber:
class: Drupal\my_module\EventSubscriber\MyEventSubscriber
arguments: ['@current_user']
tags:
- { name: event_subscriber }
Common Events
| Event | Constant | When |
|---|---|---|
| Request | KernelEvents::REQUEST | Every request |
| Response | KernelEvents::RESPONSE | Before response sent |
| Terminate | KernelEvents::TERMINATE | After response sent |
| Exception | KernelEvents::EXCEPTION | On uncaught exception |
Generate with Drush
drush generate event-subscriber --answers='{
"module": "my_module",
"class": "MyEventSubscriber",
"event": "kernel.request"
}'
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/edutrul/drupal-ai/drupal-events">View drupal-events on skillZs</a>