Download the PHP package renoki-co/laravel-exporter-contracts without Composer

On this page you can find all versions of the php package renoki-co/laravel-exporter-contracts. 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 laravel-exporter-contracts

Laravel Prometheus Exporter

CI codecov StyleCI Latest Stable Version Total Downloads Monthly Downloads License

Base contracts implementation for Prometheus exports in Laravel.

🤝 Supporting

If you are using one or more Renoki Co. open-source packages in your production apps, in presentation demos, hobby projects, school projects or so, sponsor our work with Github Sponsors. 📦

🚀 Installation

You can install the package via composer:

Publish the config:

🙌 Usage

All you have to do is to create a \RenokiCo\LaravelExporter\Metric class that defines how the values will update on each Prometheus call to scrap, and the definition of the collector.

By default, metrics are available on the /exporter/group/metrics endpoint and you can point Prometheus towards it for scraping. (i.e. http://localhost/exporter/group/metrics)

You can choose one of the following classes to extend:

For example, you can define gauges for users:

In your AppServiceProvider's boot() method, register your metric:

You don't need to set the values. When the Prometheus scraper will make the request for metrics, the gauge will automatically be set.

Labelling

You may label data by setting default values (i.e. server name, static data, etc.) and on-update.

Grouping

If you wish to have separate endpoints for different metrics, consider specifying it in the $showsOnGroup property:

Under the hood, Laravel Exporter registers a route that allows you to scrape any group:

To scrape this specifc metric (and other metrics that are associated with this group), the endpoint is /exporter/group/metrics-reloaded (i.e. http://localhost/exporter/group/metrics-reloaded).

Sending string responses

In some cases you may want to export the string-alike, Prometheus-formatted response without using the internal metrics.

To do so, use the exportResponse function. The function will return the response directly instead of relying on the Metric class and subsequent class registrations via the Exporter::register() function.

When accessing the /metrics endpoint, the response will be the one declared earlier.

For custom groups, pass a second parameter with the group name:

🐛 Testing

🤝 Contributing

Please see CONTRIBUTING for details.

🔒 Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

🎉 Credits


All versions of laravel-exporter-contracts with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
promphp/prometheus_client_php Version ^2.4
illuminate/config Version ^8.83|^9.0.1
illuminate/routing Version ^8.83|^9.0.1
illuminate/support Version ^8.83|^9.0.1
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 renoki-co/laravel-exporter-contracts contains the following files

Loading the files please wait ....