---
title: "DI and actions — Alerts for Laravel | Roundly"
description: "Inject HealthManager, the facade’s root, or call the action classes directly — with the full facade method to action map."
url: https://roundly-consulting.com/open-source/docs/alerts-for-laravel/without-facade
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Alerts for Laravel](https://roundly-consulting.com/open-source/docs/alerts-for-laravel.md)

# DI and actions

There are three equivalent entry points, and they all run the same code. Pick the one that fits the call site:

- The Health facade — the shortest, and the recommended default.
- The manager, RoundlyConsulting\\Alerts\\HealthManager — the facade’s root, a container singleton. Inject it through the constructor for the same API as an explicit dependency, with no static calls.
- The actions in RoundlyConsulting\\Alerts\\Actions — single-purpose classes with an execute() method, for composing into your own actions, jobs and commands.

## Injecting the manager

```php
use RoundlyConsulting\Alerts\HealthManager;

final class MaintenanceController
{
    public function __construct(private HealthManager $health) {}

    public function __invoke(Team $team): void
    {
        $this->health->silences()->mute('*', until: now()->addHour(), for: $team);
        $this->health->for($team)->run(DiskUsageCheck::class);
    }
}
```

Health::fake() swaps the manager for the facade and for anything that injects HealthManager, so constructor-injected code is faked too.

## Calling an action

```php
use RoundlyConsulting\Alerts\Actions\MuteAlertsAction;
use RoundlyConsulting\Alerts\Actions\ScheduleHealthCheckAction;
use RoundlyConsulting\Alerts\DataTransferObjects\ScheduleHealthCheckData;

app(ScheduleHealthCheckAction::class)->execute($team, new ScheduleHealthCheckData(check: DiskUsageCheck::class));
app(MuteAlertsAction::class)->execute('disk_usage_check', until: now()->addHour());
```

ScheduleHealthCheckAction takes the owner and a ScheduleHealthCheckData DTO (see Scheduling checks).

## Facade method → action

| Facade | Action |
| --- | --- |
| `Health::for($o)->run($check)` | `RunHealthCheckNowAction` |
| `Health::report() / Health::for($o)->report()` | `BuildHealthReportAction` |
| `Health::for($o)->monitor(...)->save() / ->schedule($data)` | `ScheduleHealthCheckAction` |
| `Health::for($o)->reconfigure($row, $changes)` | `ReconfigureHealthCheckAction` |
| `Health::for($o)->unmonitor($check)` | `UnscheduleHealthCheckAction` |
| `Health::silences()->mute(...)` | `MuteAlertsAction` |
| `Health::silences()->unmute(...)` | `UnmuteAlertsAction` |
| `Health::silences()->prune($days)` | `PruneAlertSilencesAction` |
| `Health::runDue()` | `RunDueHealthChecksAction` |
| `Health::prune($days)` | `PruneHealthCheckRunsAction` |

RunHealthCheckAction is internal: it is the pipeline behind the queued HealthCheckJob and RunHealthCheckNowAction. To run a scheduled row yourself — in a custom job, for example — call Health::for($row->notifiable)->run($row).

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/alerts-for-laravel.md)
