PHP code example of infinitypaul / laravel-uptime

1. Go to this page and download the library: Download infinitypaul/laravel-uptime 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/ */

    

infinitypaul / laravel-uptime example snippets


/**
 * The event listener mappings for the application.
 *
 * @var array
 */
protected $listen = [
    ...
    \Infinitypaul\LaravelUptime\Events\EndpointIsBackUp::class => [
        App\Listeners\URLIsBack::class,
    ],
    \Infinitypaul\LaravelUptime\Events\EndpointIsDown::class => [
        App\Listeners\YourEndPointIsDown::class,
    ],
];



namespace App\Listeners;

use Infinitypaul\LaravelUptime\Events\EndpointIsBackUp;

class URLIsBack
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  EndpointIsBackUp  $event
     * @return void
     */
    public function handle(EndpointIsBackUp $event)
    {
        // $endpointStatus = $event->getEndpointStatus();
        // $EndpointDetails = $event->getEndpoint();

        // Do something with the Endpoint and Status.
    }
}
 php
php artisan vendor:publish --provider="Infinitypaul\LaravelUptime\LaravelUptimeServiceProvider"

php artisan migrate
bash
php artisan uptime:status  
bash
php artisan uptime:status --force
bash
php artisan endpoint:remove
bash
php artisan uptime:run
bash
php artisan uptime:run --force

php artisan uptime:run