A Symfony bundle compatible with PHP 7.2+ | 8.* and Symfony 3.4 | 4.* | 5.* | 6.* | 7.* that provides default checks for your services and connections (database, HTTP client, RabbitMQ, cache...) along with custom checks.
-
Configure
composer.json
Add this repository to therepositoriessection of yourcomposer.jsonfile:"repositories": [ { "type": "vcs", "url": "https://github.com/tax16/SystemCheckBundle.git" } ]
-
Add the bundle via Composer
Run the following command in your terminal:// for symfony 3.4 to 5.4 use the tag ^1.* composer require tax16/system-check-bundle:^1.0 // for symfony 6 to 7 use the tag ^2.* composer require tax16/system-check-bundle:^2.0
-
Initialize the bundle
After installation, run the following command:php bin/console system-check:init
-
Update twig.yaml
If you want to use the UI, you need to add this path on the packages/twig.yamltwig: # other path paths: '%kernel.project_dir%/vendor/tax16/system-check-bundle/src/UserInterface/Resources/views': SystemCheckBundle
5.Update routes.yaml
If you want to use the UI, you need to add this path on the packages/twig.yaml
system_check_bundle:
resource: '@SystemCheckBundle/Infrastructure/Resources/config/routes.yaml'-
Access the System Check page
After initialization, you can access the system check page at/system-check/index.⚠️ Note: Make sure to review any security restrictions on your URLs.
-
Default Checks:
- Database connection
- HTTP client connectivity
- RabbitMQ connectivity
- Cache service status
- Php version
- Elastic search
-
Custom Checks
You can add custom checks tailored to your application requirements by implementingTax16\SystemCheckBundle\Core\Domain\Service\ServiceCheckInterface, After add tags: label, name and priority like on the Usage.
To configure custom checks, define them in config/packages/system_services.yaml. Below is an example configuration for a custom HTTP service check:
- Example of file: Download the file
# config/packages/system_services.yaml
app_service_check1:
class: Tax16\SystemCheckBundle\Infrastructure\Services\Health\Checker\HttpServiceChecker
arguments:
- 'http://mon-site2.localhost:8080/system-check/health' # URL for health check
tags:
- { name: 'system_check.health_check', label: 'http_client_1', priority: 2, description: 'Health check for test 1 via HTTP client', execute: true, parent: null }
- { name: 'system_check.health_check_trace' }### Tag Descriptions
- **`arguments`**
The first argument should be the URL for the health check. You can add a second parameter for the expected status (int).
- **`system_check.health_check` Tag**
To use this bundle, each service must implement the `system_check.health_check` tag.
- **`label`**
Use this as the name of your application.
- **`priority`**
Accepts values between 1 and 3. Set to 1 if failure is critical (error), and 3 for warnings.
- **`execute`**
Set `execute: false` if the health check cannot be executed but should still represent the service in the system network. (default = `true`)
- **`parent`**
Use this to link the health check as dependent on another service to check, for exemple, you use rabbitMq and after you need to check a application consumer. (default = `null`)
- **`system_check.health_check_trace`**
Use this tag to trace a request across systems (e.g., if Application 1 calls Application 2, this allows for a global view of the architecture). (just for `http`check)
Example of config file
You can download config file example of usage of System check from the ui
symfony cmdYou can launch the system check by executing the following command:
php bin/console system-check:health:checksymfony rest api
(GET) /system-check/health.jsonsymfony ui
/system-check/indexThe application is designed in hexagonal architecture:
To contribute to the SystemCheckBundle, follow these steps:
-
Clone the repository:
git clone https://github.com/tax16/SystemCheckBundle
-
Install dependencies:
make install
-
Run GrumPHP for code quality checks:
make grumphp
-
Run tests:
make phpunit
Happy coding! 🎉



