How this skill is triggered — by the user, by Claude, or both
Slash command
/symfony:eventsonnetThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Genere un Event personnalise et son EventSubscriber ou EventListener selon les bonnes pratiques Symfony.
Genere un Event personnalise et son EventSubscriber ou EventListener selon les bonnes pratiques Symfony.
src/Event/{EventName}.phpsrc/EventSubscriber/{HandlerName}Subscriber.php ou src/EventListener/{HandlerName}Listener.phpIMPORTANT : Execute ce workflow etape par etape :
Question: "Quel est le nom de l'evenement ? (ex: OrderPlaced, UserRegistered, InvoiceGenerated)"
Header: "Event"
Question: "Quelles donnees porte l'evenement ? Format: order:Order,user:User,amount:float (laisser vide si aucune)"
Header: "Donnees"
Question: "Quel type de handler pour cet evenement ?"
Header: "Handler"
Options:
- "EventSubscriber (Recommande)" : "Classe qui s'abonne a un ou plusieurs events via getSubscribedEvents()"
- "EventListener" : "Classe avec attribut #[AsEventListener] sur la methode de traitement"
Question: "L'evenement peut-il etre stoppe par un listener ?"
Header: "Stoppable"
Options:
- "Non (Recommande)" : "Tous les listeners seront toujours executes"
- "Oui" : "Un listener peut stopper la propagation (StoppableEventInterface)"
composer.json avec Readautoload.psr-4App par defautsrc/Event/{EventName}.php avec Write<?php
declare(strict_types=1);
namespace {namespace}\Event;
use Symfony\Contracts\EventDispatcher\Event;
final class {EventName} extends Event
{
public function __construct(
private readonly Order $order,
private readonly User $user,
) {
}
public function getOrder(): Order
{
return $this->order;
}
public function getUser(): User
{
return $this->user;
}
}
Si stoppable :
use Psr\EventDispatcher\StoppableEventInterface;
final class {EventName} extends Event implements StoppableEventInterface
{
private bool $propagationStopped = false;
public function isPropagationStopped(): bool
{
return $this->propagationStopped;
}
public function stopPropagation(): void
{
$this->propagationStopped = true;
}
}
Regles de generation :
final, extends Symfony\Contracts\EventDispatcher\Eventprivate readonly via promoted constructorEventSubscriber :
<?php
declare(strict_types=1);
namespace {namespace}\EventSubscriber;
use {namespace}\Event\{EventName};
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
final class {HandlerName}Subscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [
{EventName}::class => 'on{EventName}',
];
}
public function on{EventName}({EventName} $event): void
{
// Logique de traitement
}
}
EventListener :
<?php
declare(strict_types=1);
namespace {namespace}\EventListener;
use {namespace}\Event\{EventName};
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
final class {HandlerName}Listener
{
#[AsEventListener]
public function on{EventName}({EventName} $event): void
{
// Logique de traitement
}
}
Affiche :
Event {EventName} genere avec succes
Fichiers crees :
- src/Event/{EventName}.php
- src/EventSubscriber/{HandlerName}Subscriber.php (ou Listener)
Dispatch de l'event :
$this->eventDispatcher->dispatch(new {EventName}($order, $user));
Prochaines etapes :
- Implementer la logique dans le handler
- Injecter les services necessaires
- Dispatcher l'event depuis le service/controleur concerne
final, immuable (readonly properties)Symfony\Contracts\EventDispatcher\EventEventSubscriberInterfacegetSubscribedEvents() retourne un tableau statique#[AsEventListener] (Symfony 6.2+)EventSubscriber quand un handler ecoute plusieurs eventsEventListener avec #[AsEventListener] pour un handler simpleSymfony\Contracts\EventDispatcher\Event (pas Symfony\Component\EventDispatcher\Event)OrderPlaced, UserRegistered (pas OrderPlace)npx claudepluginhub atournayre/claude-personas --plugin symfonyReact to Doctrine entity lifecycle events in Symfony using attribute listeners and lifecycle callbacks. Helps with timestamps, slugs, search indexing, and notifications.
Generates PSR-14 compliant Event Dispatcher for PHP 8.4 including EventDispatcherInterface, ListenerProviderInterface, StoppableEventInterface with propagation, and PHPUnit tests. For event-driven architecture, DDD, CQRS.
Provides CDSS development patterns for drug interaction checking, dose validation, clinical scoring (NEWS2, qSOFA), and alert classification integrated into EMR workflows.