events

Create decoupled Event and Listener classes for Laravel-style applications.

3|Updated Feb 13, 2026
One-click install
npx skills add https://github.com/codebar-ag/coding-guidelines --skill events-codebar-ag
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: events
Source: https://github.com/codebar-ag/coding-guidelines/tree/main/resources/boost/skills/events
Command: npx skills add https://github.com/codebar-ag/coding-guidelines --skill events-codebar-ag

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

In modern applications, tight coupling between layers makes maintenance hard and changes risky. Events provide a lightweight, serializable payload to describe what happened, allowing other parts of the system to react asynchronously.

Core Features & Use Cases

  • Event objects carry simple data about changes (e.g., UserRegistered, InvoicePaid) without embedding business logic.
  • Listeners respond to specific events with isolated side effects, enabling scalable, testable workflows.
  • Use cases include audit trails, notifications, and multi-step processes triggered by a single action.

Quick Start

Dispatch an event from a triggering action and attach a listener to handle the resulting reaction.

Frequently Asked Questions about events

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

FAQPage Schema
How do I decouple application layers in Laravel using events and listeners?

To decouple application layers in Laravel, dispatch plain data event objects from triggering actions and attach isolated listeners to handle side effects. This approach separates what happened from how the system reacts, reducing tight coupling and maintenance risks.

What is the observer pattern for reducing tight coupling in PHP applications?

The observer pattern in PHP reduces tight coupling by using events as lightweight, serializable payloads that describe what happened. Independent listeners react to these events asynchronously, enabling scalable and testable workflows without embedding business logic in the event objects.

How do I set up asynchronous event listeners in a service-oriented architecture?

You set up asynchronous event listeners by implementing the optional ShouldQueue method on your listener classes. This allows events dispatched from triggering actions to be queued, enabling independent listeners to process side effects like audit trails and notifications reliably.

Can I use decoupled events for microservice integrations and multi-step processes?

Yes, decoupled events are ideal for microservice integrations and multi-step processes. They convey changes as plain data objects, allowing independent listeners across services to react to a single action with isolated side effects like notifications and audit trails.

What are the conventions for event and listener classes in Laravel-style apps?

The conventions for event and listener classes in Laravel-style apps require placing Event classes in the app/Events directory and Listener classes in app/Listeners. Listeners can implement optional ShouldQueue and failed() methods to ensure processing reliability.

Why do event listeners fail in decoupled architectures and how do I handle it?

Event listeners in decoupled architectures can fail due to asynchronous processing errors or service timeouts. You handle these failures by implementing the optional failed() method in your listener classes, which provides a reliability mechanism for queued event processing.