# Events

**Package:** Laravel Compose | **Version:** 1 | **URL:** https://mozex.dev/docs/laravel-compose/v1/operating/events

---

Each stack fires events as a redeploy goes through it. They carry the `Stack` object, and the failure event carries the step that failed and why.

| Event | When |
|---|---|
| `Mozex\Compose\Events\StackRedeployingEvent` | Before anything runs, including for stacks that turn out to be disabled. |
| `Mozex\Compose\Events\StackSkippedEvent` | The stack or the master switch is disabled. |
| `Mozex\Compose\Events\StackRedeployedEvent` | `up` succeeded. |
| `Mozex\Compose\Events\StackRedeployFailedEvent` | The compose file couldn't be read, the env file couldn't be written, or `build` or `up` failed. `$event->step` is `compose`, `env`, `build`, or `up`. `$event->result` holds the failed `ProcessResult` for `build` and `up`, `$event->exception` the throwable for `compose` and `env`, and `$event->reason()` gives you the message either way. |

A listener that tells the team when a container didn't come back:

```php
use Mozex\Compose\Events\StackRedeployFailedEvent;

class NotifyOnFailedStack
{
    public function handle(StackRedeployFailedEvent $event): void
    {
        Notification::route('slack', config('services.slack.ops'))->notify(
            new StackFailedNotification($event->stack->name(), $event->step, $event->reason()),
        );
    }
}
```

The events are plain classes. Register listeners in a service provider or through Laravel's event discovery, whichever the app uses.

---

## Table of Contents

- [Introduction](https://mozex.dev/docs/laravel-compose/v1)
- [AI Integration](https://mozex.dev/docs/laravel-compose/v1/ai-integration)
- [Support Us](https://mozex.dev/docs/laravel-compose/v1/support-us)
- [Requirements](https://mozex.dev/docs/laravel-compose/v1/requirements)
- [Changelog](https://mozex.dev/docs/laravel-compose/v1/changelog)
- [Contributing](https://mozex.dev/docs/laravel-compose/v1/contributing)
- [Questions & Issues](https://mozex.dev/docs/laravel-compose/v1/questions-and-issues)
- [About Mozex](https://mozex.dev/docs/laravel-compose/v1/about)
- [Installation](https://mozex.dev/docs/laravel-compose/v1/installation)
- [Configuration](https://mozex.dev/docs/laravel-compose/v1/configuration)

### Stacks

- [Defining a Stack](https://mozex.dev/docs/laravel-compose/v1/stacks/defining-a-stack)
- [Discovery](https://mozex.dev/docs/laravel-compose/v1/stacks/discovery)
- [Environment Files](https://mozex.dev/docs/laravel-compose/v1/stacks/environment-files)
- [Compose Files](https://mozex.dev/docs/laravel-compose/v1/stacks/compose-files)

### Deploying

- [Redeploy](https://mozex.dev/docs/laravel-compose/v1/deploying/redeploy)
- [Hosting Platforms](https://mozex.dev/docs/laravel-compose/v1/deploying/hosting-platforms)
- [Remote Daemons](https://mozex.dev/docs/laravel-compose/v1/deploying/remote-daemons)
- [Doctor](https://mozex.dev/docs/laravel-compose/v1/deploying/doctor)

### Operating

- [Status, Logs, and Down](https://mozex.dev/docs/laravel-compose/v1/operating/status-logs-down)
- [Health Check](https://mozex.dev/docs/laravel-compose/v1/operating/health-check)
- [Events](https://mozex.dev/docs/laravel-compose/v1/operating/events)
- [Testing](https://mozex.dev/docs/laravel-compose/v1/operating/testing)

### Recipes

- [Meilisearch](https://mozex.dev/docs/laravel-compose/v1/recipes/meilisearch)
- [Telegram Bot API](https://mozex.dev/docs/laravel-compose/v1/recipes/telegram-bot-api)