PHP code example of postalservice14 / php-actuator-slim-provider
1. Go to this page and download the library: Download postalservice14/php-actuator-slim-provider 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/ */
postalservice14 / php-actuator-slim-provider example snippets
$container = $app->getContainer();
$container['health.aggregator'] = new OrderedHealthAggregator();
$container['health.indicators'] = array(
'disk' => new DiskSpaceHealthIndicator()
);
$container['health'] = function ($container) {
return new HealthServiceProvider(
$container['health.aggregator'],
$container['health.indicators']
);
};
$app->get('/health', function ($req, $res) {
return $this->health->getHealth($res);
});
lim\App;
use Actuator\Health\OrderedHealthAggregator;
use Actuator\Health\Indicator\DiskSpaceHealthIndicator;
use Actuator\Slim\Provider\HealthServiceProvider;
$indicators = array(
'disk' => new DiskSpaceHealthIndicator()
);
$app = new App();
$container = $app->getContainer();
$container['health.aggregator'] = new OrderedHealthAggregator();
$container['health.indicators'] = $indicators;
$container['health'] = function ($container) {
return new HealthServiceProvider(
$container['health.aggregator'],
$container['health.indicators']
);
};
$app->get('/health', function ($req, $res) {
return $this->health->getHealth($res);
});
$app->run();
bash
$ composer