Search by

ervinsvilumsons / laravel-alert

ervinsvilumsons

Laravel Alert is a package that provides an easy way to notify failed service alerts in Laravel applications.

Package info

github.com/ervinsvilumsons/laravel-alert

pkg:composer/ervinsvilumsons/laravel-alert

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.4 2026-09-16 17:05 UTC

This package is auto-updated.

Last update: 2026-09-16 17:07:20 UTC


README

Latest Version on Packagist PHP 8.4+ Laravel 11+ Tests codecov License

Laravel Alert provides a small, configurable way to notify a group of recipients.

๐Ÿ“ฆ Installation

composer require ervinsvilumsons/laravel-alert

Publish the configuration:

php artisan vendor:publish --tag=alert-manager

This creates config/alert-manager.php.

๐Ÿ“ข Channels

Mail

Slack
composer require laravel/slack-notification-channel

The notification app must be invited to the Slack channel before alerts will be delivered. Read more about Slack notification configuration.

๐Ÿš€ Quick Start

use AlertManager;

AlertManager::send(
    key: 'order_' . $order->id,
    title: 'Payment service unavailable',
    message: 'The payment provider did not respond.',
    context: [
        'order_id' => $order->id,
        'provider' => 'acme-payments',
    ],
    level: 'critical',
);

Configuration

The default configuration is:

return [
    'enabled' => env('ALERTS_ENABLED', true),
    'queue' => env('ALERTS_QUEUE', 'default'),
    'channels' => [
        'mail' => ['admin@example.com'],
        // 'slack' => ['slack channel name'],
    ],
    'throttle' => [
        'ttl' => 3600,
        'path' => storage_path('framework/cache/alert-throttle'),
    ],
    'notification' => AlertNotification::class,
];

Custom notification

To add or replace notification channels, create a notification class with the same constructor data shape and configure it in config/alert-manager.php:

'notification' => App\Notifications\CustomAlertNotification::class,

๐Ÿงน Console Commands

alert:prune-throttle

Alert throttling stores lock files in the directory configured under alert-manager.throttle.path (default: storage/framework/cache/alert-throttle). To remove all existing throttle lock files:

php artisan alert:prune-throttle

The command is registered automatically and scheduled daily by the package's service provider. You do not need to wire anything into app/Console/Kernel.php or routes/console.php.

Sample output:

Deleted 3 file(s).

โš–๏ธ License

Laravel Alert Manager is released under the MIT License.