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' );
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 ),
'queue' => env('APP_PULSE_SCHEDULER_QUEUE' , 'default' ),
'chunk' => env('APP_PULSE_SCHEDULER_CHUNK' , 100 ),
],
];
use CleaniqueCoders \AppPulse \Models \Monitor ;
$monitor = Monitor::create([
'owner_type' => \App\Models\User::class,
'owner_id' => 1 ,
'url' => 'https://example.com' ,
'interval' => 10 ,
'ssl_check' => true ,
]);
'scheduler' => [
'interval' => env('APP_PULSE_SCHEDULER_INTERVAL' , 10 ),
'queue' => env('APP_PULSE_SCHEDULER_QUEUE' , 'default' ),
'chunk' => env('APP_PULSE_SCHEDULER_CHUNK' , 100 ),
],
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