PHP code example of cronitor / laravel

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

    

cronitor / laravel example snippets


// config/cronitor.php
return [
    'enabled' => env('CRONITOR_ENABLED', true),
    'api_key' => env('CRONITOR_API_KEY'),
    'api_version' => env('CRONITOR_API_VERSION'),
    'environment' => env('CRONITOR_ENVIRONMENT'),

    'monitor_defaults' => [],
    'ignored_jobs' => [],
    'ignored_tasks' => [],
];

'monitor_defaults' => [
    'notify' => ['devops-alerts'],
    'group' => 'platform-jobs',
],

use Cronitor\Laravel\Contracts\DefinesCronitorKey;

class ShipOrder implements DefinesCronitorKey
{
    public function cronitorKey(): string
    {
        return 'ship-order';
    }
}
bash
php artisan vendor:publish --tag=cronitor-config
bash
php artisan cronitor:sync --dry-run
bash
php artisan cronitor:sync