PHP code example of jordanbrauer / cronitor-php

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

    

jordanbrauer / cronitor-php example snippets




use \Cronitor\Monitor;

$cronitor = new Monitor("monitor_id");

$cronitor = new Monitor("monitor_id", [
  "base_url" => "https://cronitor.link",
  "auth_key" => "your_private_secret_confidential_auth_key",
]);

$cronitor->run(); // plain run ping
$cronitor->run("Hello Cronitor!"); // run ping with message

$cronitor->complete(); // plain complete ping
$cronitor->complete("Goodbye Cronitor!"); // complete ping with message

$cronitor->fail(); // plain fail ping
$cronitor->fail("Damn Cronitor!"); // fail ping with message

$cronitor->pause(1); // pause for 1 hour

$cronitor->resume(); // resume monitoring
shell
$ composer