PHP code example of cronalive / laravel

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

    

cronalive / laravel example snippets


// routes/console.php — by check UUID:
$schedule->command('backup:run')
    ->daily()
    ->pingCronalive('<uuid>');

// by slug with auto-provisioning (the check is created on first ping):
$schedule->command('etl:run')->hourly()->pingCronaliveSlug('etl-run');

// with a custom grace period and tags — named arguments, see below:
$schedule->command('backup:run')
    ->dailyAt('03:30')
    ->pingCronaliveSlug('backup', graceSec: 1800, tags: ['backups', 'prod']);

// a plain ping outside the scheduler (fire-and-forget, never throws):
use Cronalive\Laravel\Cronalive;

Cronalive::ping('<uuid>');          // success
Cronalive::ping('<uuid>', 'fail');  // explicit failure

pingCronaliveSlug(string $slug, bool $create = true, ?int $graceSec = null, ?array $tags = null)