PHP code example of marko / health

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

    

marko / health example snippets


use Marko\Health\Contracts\HealthCheckInterface;
use Marko\Health\Value\HealthResult;
use Marko\Health\Value\HealthStatus;

class RedisHealthCheck implements HealthCheckInterface
{
    public function getName(): string
    {
        return 'redis';
    }

    public function check(): HealthResult
    {
        return new HealthResult(
            name: $this->getName(),
            status: HealthStatus::Healthy,
            message: 'Redis connection successful',
            metadata: [],
            duration: 0.001,
        );
    }
}