Download the PHP package lgarret/health-check-bundle without Composer

On this page you can find all versions of the php package lgarret/health-check-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package health-check-bundle

HealthCheckBundle

CI Latest Stable Version License

A Symfony bundle providing a /health endpoint to monitor your application and its dependencies.

Installation

Register the bundle

Import routes

Allow public access

If you use the Symfony SecurityBundle, make sure the health route is publicly accessible:

Configuration

Option Type Default Description
path string /health URL path for the health check endpoint.
secret string? null Token expected in the configured header. If null, details are never exposed.
header string Authorization Name of the HTTP header used to send the secret token.
timeout int 5 Maximum execution time in seconds for each individual check.
cache.enabled bool true Enable caching of health check results.
cache.ttl int 300 Cache TTL in seconds (5 minutes by default).
checks.doctrine bool true Auto-register Doctrine DBAL checks (one per connection) if doctrine/dbal is installed.
checks.asset_mapper bool true Auto-register AssetMapper check if symfony/asset-mapper is installed.

Usage

GET /health

Without auth header (or without a configured secret):

With a valid auth header:

Console command

Run checks from the command line:

Built-in checks

The bundle ships with built-in checks that are automatically registered when the corresponding packages are installed:

Check Package required What it does
doctrine doctrine/dbal Runs SELECT 1 on each configured DBAL connection
asset_mapper symfony/asset-mapper Checks that manifest.json exists (assets compiled)

Built-in checks are enabled by default and auto-detected via class_exists() and service availability. One check is registered per Doctrine connection (e.g. doctrine_default, doctrine_analytics). The asset mapper check verifies that public/assets/manifest.json exists (i.e. asset-map:compile has been run). You can disable them in your configuration:

Creating a custom check

Implement HealthCheckInterface — the service will be automatically discovered and registered:

Querying a remote health check endpoint

HealthCheckClient lets you query the /health endpoint of another Symfony application (e.g. a different site running this same bundle) and get back a typed result instead of raw JSON. It requires symfony/http-client:

HealthCheckClient::check() returns a RemoteHealthCheckResult:

Property Type Description
reachable bool false if the request failed at the network level or the response couldn't be parsed
report ?HealthCheckReport The remote health report (status + checks), present only when reachable is true
error ?string Error message, present only when reachable is false

If no secret (or an empty string) is provided, the remote endpoint will only return its global status (no checks detail), matching the unauthenticated response documented above.

HealthCheckClient is only registered as a service when symfony/http-client is installed (auto-detected, like the built-in checks). If it isn't installed, autowiring HealthCheckClient fails with Symfony's standard "service not found" error at compile time, rather than a runtime exception.

Flex recipe

Sample configuration files are available in the recipe/ directory for use with Symfony Flex.

Development

License

MIT


All versions of health-check-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
symfony/cache Version ^6.4 || ^7.0 || ^8.0
symfony/console Version ^6.4 || ^7.0 || ^8.0
symfony/framework-bundle Version ^6.4 || ^7.0 || ^8.0
symfony/http-client-contracts Version ^3.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lgarret/health-check-bundle contains the following files

Loading the files please wait ...