PHP code example of fruitcake / magento2-health-check
1. Go to this page and download the library: Download fruitcake/magento2-health-check 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/ */
fruitcake / magento2-health-check example snippets
use Fruitcake\HealthCheck\Model\CheckResult;
use Fruitcake\HealthCheck\Observer\AbstractCheck;
class Erp extends AbstractCheck
{
// Add a constructor with your own dependencies; pass Config on to parent::__construct()
public function getCode(): string
{
return 'erp';
}
protected function check(): CheckResult
{
return $this->isConnected()
? CheckResult::ok()
: CheckResult::failed('ERP is not reachable');
}
}