PHP code example of bramr / stack-heartbeat

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

    

bramr / stack-heartbeat example snippets


public function __construct(HttpKernelInterface $app, $route = '/heartbeat.check', callable $handler = null)

$app = new  CallableHttpKernel(function (Request $request) {
    return new Response('#yolo');
});

$app = (new Stack\Builder)
    ->push(BramR\Stack\Heartbeat::class)
    ->push(BramR\Stack\Heartbeat::class, '/custom', function () use ($diContainer) {
        return new Response(
            'Implement custom heartbeat check, to check some stuff in db:' . $diContainer['db.name']
        );
    })
    ->resolve($app);

Stack\run($app);