PHP code example of ervinsvilumsons / laravel-alert

1. Go to this page and download the library: Download ervinsvilumsons/laravel-alert library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ervinsvilumsons / laravel-alert example snippets


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',
);

return [
    'enabled' => env('ALERTS_ENABLED', true),
    'queue' => env('ALERTS_QUEUE', 'default'),
    'channels' => [
        'mail' => ['[email protected]'],
        // 'slack' => ['slack channel name'],
    ],
    'throttle' => 3600,
    'notification' => AlertNotification::class,
];

'notification' => App\Notifications\CustomAlertNotification::class,
bash
php artisan vendor:publish --tag=alert-manager