PHP code example of tourze / psr15-health-check-request-handler
1. Go to this page and download the library: Download tourze/psr15-health-check-request-handler 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/ */
tourze / psr15-health-check-request-handler example snippets
use Tourze\PSR15HealthCheckRequestHandler\HealthCheckRequestHandler;
$handler = new HealthCheckRequestHandler();
$response = $handler->handle($request); // $request must implement ServerRequestInterface
use ReflectionProperty;
use Tourze\PSR15HealthCheckRequestHandler\HealthCheckRequestHandler;
$handler = new HealthCheckRequestHandler();
// Change health check paths
$pathsProperty = new ReflectionProperty(HealthCheckRequestHandler::class, 'healthCheckPaths');
$pathsProperty->setAccessible(true);
$pathsProperty->setValue($handler, ['/custom-health']);
// Change healthy response text
$okTextProperty = new ReflectionProperty(HealthCheckRequestHandler::class, 'okText');
$okTextProperty->setAccessible(true);
$okTextProperty->setValue($handler, 'service is healthy');