Download the PHP package cpsit/monitoring without Composer

On this page you can find all versions of the php package cpsit/monitoring. 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 monitoring

# Monitoring [![Coverage](https://img.shields.io/coverallsCoverage/github/CPS-IT/monitoring?logo=coveralls)](https://coveralls.io/github/CPS-IT/monitoring) [![Maintainability](https://img.shields.io/codeclimate/maintainability/CPS-IT/monitoring?logo=codeclimate)](https://codeclimate.com/github/CPS-IT/monitoring/maintainability) [![CGL](https://img.shields.io/github/actions/workflow/status/CPS-IT/monitoring/cgl.yaml?label=cgl&logo=github)](https://github.com/CPS-IT/monitoring/actions/workflows/cgl.yaml) [![Tests](https://img.shields.io/github/actions/workflow/status/CPS-IT/monitoring/tests.yaml?label=tests&logo=github)](https://github.com/CPS-IT/monitoring/actions/workflows/tests.yaml) [![Supported PHP Versions](https://img.shields.io/packagist/dependency-v/cpsit/monitoring/php?logo=php)](https://packagist.org/packages/cpsit/monitoring)

This package provides a generic monitoring solution for web applications. It can be used to monitor various parts of your application by implementing a set of monitoring providers and exposing their health state by using a dedicated monitoring route. The package is highly customizable in terms of implementing custom monitoring providers and authorization solutions.

🔥 Installation

Packagist Packagist Downloads

⚡ Usage

Monitoring service

The package ships a Monitoring class which can be used to check health of various services.

Services can be defined using the MonitoringProvider interface. Each provider can reveal the health state of the underlain service using the isHealthy() method.

Report errors

In addition to the normal health state, providers might also be able to report errors which occurred during health check. For this, an ExceptionAwareMonitoringProvider interface exists. It allows to fetch errors using the getLastException() method.

Provide individual status information

Each provider can be extended to return individual status information. This is possible once the StatusInformationAwareMonitoringProvider interface is implemented within a concrete provider.

Middleware

Additionally, a middleware MonitoringMiddleware exists. It can be used to make health checks available using the middleware stack of a web application. A set of monitoring providers needs to be provided when constructing the middleware. This can be best achieved with a PSR-11 service container, e.g. within a Symfony or Symfony-based application.

In case the monitoring result is healthy, a 200 OK response will be returned, otherwise the response is 424 Failed Dependency. All responses are in JSON format and contain the serialized monitoring result. If an internal error occurs (such as failed JSON encoding), the response is 500 Internal Server Error and the response body contains the error message in JSON format.

Validators

The middleware acts only on valid requests. The decision as to whether a request is valid is in the hands of so called validators. Each validator must implement the Validator interface.

The package already provides the RouteValidator. It can be configured to allow only requests to a given route, which is /monitor/health by default. In case this route is matched, the request is valid and therefore the monitoring process will be triggered.

Authorizers

Requests handled by the provided middleware can be secured using a list of authorizers. Authorizers are classes which implement the Authorizer interface. Each authorizer must implement the isAuthorized() method. In case any authorizer returns true, the request will be processed as is. If no authorizer is able to give the appropriate authorization, a 401 Unauthorized response will be returned.

Authorizers can be prioritized by defining an explicit priority using the getPriority() method. Authorizers with higher priority will be executed first.

Dependency injection

The package already provides a ready-made container configuration for dependency injection based on Symfony dependency injection. This is particularly helpful if several monitoring providers are to be automatically configured on the middleware.

For this purpose, it is necessary to install the following packages via Composer:

[!NOTE] The dependency injection configuration is an optional component of this package. Therefore, required Composer packages are not explicitly required, but only suggested. You must install them by your own.

The next step is to load the configuration into the container. For this, the package provides a helper class ServiceConfigurator:

All classes that are configured in the service container and implement the MonitoringProvider interface are now automatically tagged with monitoring.provider. The MonitoringProviderCompilerPass then takes care of the autoconfiguration of all tagged monitoring providers at the MonitoringMiddleware class.

🧑‍💻 Contributing

Please have a look at CONTRIBUTING.md.

⭐ License

This project is licensed under GNU General Public License 3.0 (or later).


All versions of monitoring with dependencies

PHP Build Version
Package Version
Requires php Version ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0
ext-json Version *
guzzlehttp/guzzle Version ^6.5 || ^7.0
guzzlehttp/psr7 Version ^1.9 || ^2.0
psr/http-message Version ^1.0 || ^2.0
psr/http-server-handler Version ^1.0
psr/http-server-middleware Version ^1.0
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 cpsit/monitoring contains the following files

Loading the files please wait ....