PHP code example of kilofox / php-actuator-hyperf-provider
1. Go to this page and download the library: Download kilofox/php-actuator-hyperf-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/ */
kilofox / php-actuator-hyperf-provider example snippets
Router::addRoute(['GET'], '/health', 'App\Controller\IndexController@health');
namespace App\Controller;
use Hyperf\Di\Annotation\Inject;
use Kilofox\Actuator\HealthServiceProvider;
class IndexController extends AbstractController
{
/**
* @Inject
* @var HealthServiceProvider
*/
private $health;
public function index()
{
$memcached = new \Memcached();
$memcached->addServer('127.0.0.1', 11211);
return $this->health
->addIndicator('disk')
->addIndicator('memcached', $memcached)
->getHealth($this->response);
}
}
bash
$ composer