PHP code example of bretrzaun / statuspage

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

    

bretrzaun / statuspage example snippets


$checker = new \BretRZaun\StatusPage\StatusChecker();
// add your checks here
$checker->addCheck(...);

// in different groups if you like
$group = new StatusCheckerGroup('Group 01');
$group->addCheck(...);
$group->addCheck(...);
$checker->addGroup($group);

// run the checks
$checker->check();

// use the built-in Twig template
$loader = new Twig_Loader_Filesystem('resources/views/');
$twig = new Twig_Environment($loader, ['autoescape' => false]);

$content = $twig->render(
    'bootstrap_5.html.twig',
        [
            'results' => $checker->getResults(),
            'title' => 'My status page'
        ]
    );
$code = $checker->hasErrors() ? 503 : 200;
// create a response with $content and $code