PHP code example of akondas / symfony-actuator-bundle

1. Go to this page and download the library: Download akondas/symfony-actuator-bundle 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/ */

    

akondas / symfony-actuator-bundle example snippets


Akondas\ActuatorBundle\ActuatorBundle::class => ['all' => true]



declare(strict_types=1);

namespace App\Health;

use Akondas\Service\Health\HealthIndicator;
use Akondas\Service\Health\Health;

class CustomHealthIndicator implements HealthIndicator
{
    public function name(): string
    {
        return 'custom';
    }

    public function health(): Health
    {
        return Health::up()->setDetails(['state' => 'OK!']);
    }
}



declare(strict_types=1);

namespace App\Info;

use Akondas\Service\Info\Collector\Collector;
use Akondas\Service\Info\Info;

class CustomInfoCollector implements Collector
{
    public function collect(): Info
    {
        return new Info('my-info', [ 'time' => time() ]);
    }
}
json
  {
    "git": {
      "branch": "actuator",
      "commit": "6c01dce07274c6fddfd58610cf5fe14964689edd"
    },
    "php": {
      "version": "7.4.3",
      "architecture": 64,
      "intlLocale": "en",
      "timezone": "Europe/Berlin",
      "xdebugEnabled": false,
      "apcuEnabled": false,
      "opCacheEnabled": true
    },
    "symfony": {
      "version": "5.2.2",
      "lts": false,
      "environment": "dev",
      "endOfMaintenance": "July 2021",
      "endOfLife": "July 2021",
      "bundles": {
        "FrameworkBundle": "Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle",
        "SensioFrameworkExtraBundle": "Sensio\\Bundle\\FrameworkExtraBundle\\SensioFrameworkExtraBundle",
        "TwigBundle": "Symfony\\Bundle\\TwigBundle\\TwigBundle",
        "MonologBundle": "Symfony\\Bundle\\MonologBundle\\MonologBundle",
        "DoctrineBundle": "Doctrine\\Bundle\\DoctrineBundle\\DoctrineBundle",
        "DoctrineMigrationsBundle": "Doctrine\\Bundle\\MigrationsBundle\\DoctrineMigrationsBundle",
        "SecurityBundle": "Symfony\\Bundle\\SecurityBundle\\SecurityBundle",
        "ActuatorBundle": "Akondas\\ActuatorBundle\\ActuatorBundle"
      }
    },
    "database": {
      "default": {
        "type": "stgreSQL100",
        "database": "app",
        "driver": "Symfony\\Bridge\\Doctrine\\Middleware\\Debug\\Driver"
      }
    }
  }