Program additional checks

With a little bit of programming knowledge you also have the possibility to execute not yet supported health checks for other functions. For example the connection to Redis.

Database example

First you have to write a PHP class in your plugin that contains the logic. It is important that the interface `HealthCheckInterface` is implemented.

namespace ShopStudio\HealthCheck\Core\HealthCheck;

use Doctrine\DBAL\Connection;

class DatabaseHealthCheck implements HealthCheckInterface
    public const NAME = 'database';

    private Connection $connection;

    public function __construct(Connection $connection)
        $this->connection = $connection;

    public function getName(): string
        return self::NAME;

    public function check(): ?HealthCheckResult
        $up = true;

        try {
        } catch (\Throwable $throwable) {
            $up = false;

        return new HealthCheckResult($up, ['additional' => 'payload']);

Then implement the PHP class as a service in services.xml. Don't forget to tag the service as

<?xml version="1.0" ?>

<container xmlns=""

        <service id="ShopStudio\HealthCheck\Core\HealthCheck\DatabaseHealthCheck">
            <argument type="service" id="Doctrine\DBAL\Connection" />
            <tag name=""/>


Last updated