PHP code example of synergitech / cronitor-laravel

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

    

synergitech / cronitor-laravel example snippets


use SynergiTech\Cronitor\Laravel\Contracts\HasCronitorKey;

class YourJob implements HasCronitorKey
{
    public function getMonitorKey(): string
    {
        return 'your monitor key from cronitor.io';
    }
}

use SynergiTech\Cronitor\Laravel\Facades\Cronitor;

class YourClass
{
    public function handle()
    {
        Cronitor::monitorJob('your monitor key', function () {
            throw new \Exception('This will automatically be reported as a fail event');
        });
    }
}
sh
php artisan vendor:publish --provider="SynergiTech\Cronitor\Laravel\CronitorServiceProvider"