Download the PHP package zlodes/prometheus-client-laravel without Composer

On this page you can find all versions of the php package zlodes/prometheus-client-laravel. 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 prometheus-client-laravel

PHP Prometheus Exporter for Laravel

codecov

This is a Laravel adapter/bridge package for zlodes/prometheus-client.

First steps

Installation

Register a route for the metrics controller

Your application is responsible for metrics route registration. There is a controller ready to use. You can configure groups, middleware or prefixes as you want.

Example:

Configure Storage for metrics [optional]

By default, it uses Redis storage.

If you want to use a different storage backend (e.g. a custom driver shipped by your application), register it by extending the StorageConfigurator in your own ServiceProvider::register():

Then publish the config and select your driver:

callAfterResolving is the right hook here: this package's ServiceProvider::boot() asks the container to resolve StorageConfigurator as part of its method signature, which runs your registered callback first, and only after that does boot() call $storageConfigurator->configure(). This guarantees your custom driver is registered before the storage bindings are resolved.

All four storage contracts (CounterStorage, GaugeStorage, HistogramStorage, SummaryStorage) must be provided for a driver — extend() validates this, along with checking that each implementation actually satisfies its contract. The built-in null driver name is reserved (it backs the enabled => false kill switch) and cannot be overridden, but you can freely override in_memory or redis if you want to replace the built-in implementations.

Metrics registration

In your ServiceProvider::register:

Metrics Collector usage

You can work with your metrics whenever you want. Just use Collector:

Schedulable collectors

At times, there may be a need to gather metrics on a scheduled basis. The package offers a feature to register a SchedulableCollector that executes every minute using the Laravel Scheduler.

You can define your SchedulableCollectors using a config or register it in SchedulableCollectorRegistry directly in a ServiceProvider:

Note For further details, see zlodes/prometheus-client

Available console commands

Command Description
php artisan metrics:list Lists all registered metrics
php artisan metrics:clear Clears metrics storage
metrics:collect-scheduled Runs ScheduledCollectors. Using by Scheduler

Upgrade guide

From 1.x to 2.x

  1. Run php artisan vendor:publish --tag=prometheus-client to publish a brand-new config
  2. Configure the new config based on the previous one (prometheus-exporter.php)
  3. Drop legacy config (prometheus-exporter.php)

Testing

Run tests


All versions of prometheus-client-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-redis Version *
laravel/framework Version ^11.0 || ^12.0 || ^13.0
webmozart/assert Version ^1.11 || ^2.0
zlodes/prometheus-client Version ^2.0.4
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 zlodes/prometheus-client-laravel contains the following files

Loading the files please wait ...