PHP code example of cleaniquecoders / app-pulse

1. Go to this page and download the library: Download cleaniquecoders/app-pulse 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/ */

    

cleaniquecoders / app-pulse example snippets


config/app-pulse.php

return [
    'events' => [
        \CleaniqueCoders\AppPulse\Events\MonitorUptimeChanged::class => [],
        \CleaniqueCoders\AppPulse\Events\SslStatusChanged::class => [],
    ],
    'scheduler' => [
        'interval' => env('APP_PULSE_SCHEDULER_INTERVAL', 10), // Minutes between checks
        'queue' => env('APP_PULSE_SCHEDULER_QUEUE', 'default'), // Queue to use
        'chunk' => env('APP_PULSE_SCHEDULER_CHUNK', 100), // Monitors per batch
    ],
];

use CleaniqueCoders\AppPulse\Models\Monitor;

$monitor = Monitor::create([
    'owner_type' => \App\Models\User::class, // Owner model type
    'owner_id' => 1, // Owner ID (e.g., User or Application)
    'url' => 'https://example.com', // URL to monitor
    'interval' => 10, // Interval (in minutes) between checks
    'ssl_check' => true, // Enable or disable SSL check
]);

   'scheduler' => [
       'interval' => env('APP_PULSE_SCHEDULER_INTERVAL', 10), // Run every 10 minutes
       'queue' => env('APP_PULSE_SCHEDULER_QUEUE', 'default'), // Queue to use
       'chunk' => env('APP_PULSE_SCHEDULER_CHUNK', 100), // Process monitors in batches
   ],
   

protected $listen = [
    \CleaniqueCoders\AppPulse\Events\MonitorUptimeChanged::class => [
        \App\Listeners\HandleUptimeChange::class,
    ],
    \CleaniqueCoders\AppPulse\Events\SslStatusChanged::class => [
        \App\Listeners\HandleSslStatusChange::class,
    ],
];
bash
php artisan vendor:publish --tag="app-pulse-config"
php artisan vendor:publish --tag="app-pulse-migrations"
bash
php artisan migrate
bash
php artisan monitor:check-status