PHPackages                             avto-dev/app-metrics-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. avto-dev/app-metrics-laravel

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

avto-dev/app-metrics-laravel
============================

Metrics endpoint for Laravel applications

v2.9.0(10mo ago)421.3k↓42.1%7MITPHPPHP ^8.2CI passing

Since Sep 18Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/avto-dev/app-metrics-laravel)[ Packagist](https://packagist.org/packages/avto-dev/app-metrics-laravel)[ RSS](/packages/avto-dev-app-metrics-laravel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (15)Used By (0)

 [![Laravel](https://camo.githubusercontent.com/640c3d52b2764f179ef3cf089b604516a8c4ac0a06f055a46c6a7fce9428b787/68747470733a2f2f6c61726176656c2e636f6d2f6173736574732f696d672f636f6d706f6e656e74732f6c6f676f2d6c61726176656c2e737667)](https://camo.githubusercontent.com/640c3d52b2764f179ef3cf089b604516a8c4ac0a06f055a46c6a7fce9428b787/68747470733a2f2f6c61726176656c2e636f6d2f6173736574732f696d672f636f6d706f6e656e74732f6c6f676f2d6c61726176656c2e737667)

Metrics endpoint for Laravel applications
=========================================

[](#metrics-endpoint-for-laravel-applications)

[![Version](https://camo.githubusercontent.com/1169c07df7604390933eed4d0fef2787fce2fb86775b6cba3a36b50440f40f34/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6176746f2d6465762f6170702d6d6574726963732d6c61726176656c2e7376673f6d61784167653d313830)](https://packagist.org/packages/avto-dev/app-metrics-laravel)[![PHP Version](https://camo.githubusercontent.com/fde6485f4ab691a3288884a6268166285c08e4443e62d36479f5690867b93389/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6176746f2d6465762f6170702d6d6574726963732d6c61726176656c2e7376673f6c6f6e6743616368653d74727565)](https://packagist.org/packages/avto-dev/app-metrics-laravel)[![Build Status](https://camo.githubusercontent.com/36c5e1272f79e1061c4d80f2f6c2eabef36779e59054a814403f920087d50298/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6176746f2d6465762f6170702d6d6574726963732d6c61726176656c2f74657374732e796d6c3f763d32)](https://github.com/avto-dev/app-metrics-laravel/actions)[![Coverage](https://camo.githubusercontent.com/a37d93867cc9fd6c23cad0d2141fe54e5d16db0e0be5633eabf0cc34b7b4d1a6/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6176746f2d6465762f6170702d6d6574726963732d6c61726176656c2f6d61737465722e7376673f6d61784167653d3630)](https://codecov.io/gh/avto-dev/app-metrics-laravel/)[![Downloads count](https://camo.githubusercontent.com/9892a04086eb4a1dcf3c8c131850d0380907debff090953c440bcf8b2e346b14/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6176746f2d6465762f6170702d6d6574726963732d6c61726176656c2e7376673f6d61784167653d313830)](https://packagist.org/packages/avto-dev/app-metrics-laravel)[![License](https://camo.githubusercontent.com/27a67ee3fe6012506c215be2b5edd6cbb62598cd35be67066bbd05690d14e27c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6176746f2d6465762f6170702d6d6574726963732d6c61726176656c2e7376673f6c6f6e6743616368653d74727565)](https://github.com/avto-dev/app-metrics-laravel/blob/master/LICENSE)

Using this package provides easy way for integration metrics endpoint into your Illuminate-based application.

Install
-------

[](#install)

Require this package with composer using the following command:

```
$ composer require avto-dev/app-metrics-laravel "^2.0"
```

> Installed `composer` is required ([how to install composer](https://getcomposer.org/download/)).

> You need to fix the major version of package.

After that you should "publish" package configuration file using next command:

```
$ php ./artisan vendor:publish --provider="AvtoDev\\AppMetrics\\ServiceProvider"
```

And configure it in the file `./config/metrics.php`.

Usage
-----

[](#usage)

Feel free to write your own metric classes and add it after into `metrics.metric_classes` configuration array.

> Metric class must implements `MetricInterface` and optionally `HasDescriptionInterface`/`HasLabelsInterface`/`HasTypeInterface`. In metric constructor you can request any dependencies - DI will inject it automatically.

> Also metric class can implements `MetricsGroupInterface` (for metrics grouping).

When your metric classes are ready and successfully registered into configuration file - you can request special route (`/metrics` by default):

```
$ curl http://127.0.0.1:8080/metrics?format=json
[{"name": "some_metric", "value": 1, "labels": {"foo":"bar"}}]

$ curl http://127.0.0.1:8080/metrics?format=prometheus
some_metric{foo="bar"} 1
```

> Configuration allows you to change endpoint URI, set password protection, and more.

Secret verification can be completed using sending get-parameter `?secret=XXX` or HTTP header `X-SECRET`.

### Formatters

[](#formatters)

Out of the box this package provides `json` and `prometheus` metrics formats. Feel free to write your own formatters.

#### Prometheus formatter

[](#prometheus-formatter)

Prometheus formatter uses some constants for metric's values(`Nan`, `+Inf`, `-Inf`) and types(`counter`,`summary`,`gauge`,`histogram`, `untyped`). You can find it in [`PrometheusValuesDictionary`](./src/Formatters/Dictionaries/PrometheusValuesDictionary.php) and [`HasTypeInterface`](./src/Metrics/HasTypeInterface.php)

Keep in mind that `Prometheus` accepts only numeric metrics values. This formatter will try to cast metrics values to numeric format (`integer` or `float`). And will set `Nan` if casting to numeric is impossible. Examples for formatting values:

InputOutput`1.2``'1.2'``1``'1'``true``'1'``false``'0'``'123'``'123'``'12foo'``'Nan'``['10', '20']``'Nan'``null``'Nan'``'Nan'``'Nan'``'+Inf'``'+Inf'``'-Inf'``'-Inf'`### Skipping metrics

[](#skipping-metrics)

If during construction or formatting metrics would be thrown exception that implements `AvtoDev\AppMetrics\Exceptions\ShouldBeSkippedMetricExceptionInterface` then this metric would be skipped from formatters output and exception would be reported by `Illuminate\Contracts\Debug\ExceptionHandler`

### Testing

[](#testing)

For package testing we use `phpunit` framework and `docker` with `compose` plugin as develop environment. So, just write into your terminal after repository cloning:

```
$ make build
$ make latest # or 'make lowest'
$ make test
```

Changes log
-----------

[](#changes-log)

[![Release date](https://camo.githubusercontent.com/c7b8d280e2b118cfe2147e83c6398c5f2664542b12395ba6cdd390cd8b5b6fa1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652d646174652f6176746f2d6465762f6170702d6d6574726963732d6c61726176656c2e7376673f7374796c653d666c61742d737175617265266d61784167653d313830)](https://github.com/avto-dev/app-metrics-laravel/releases)[![Commits since latest release](https://camo.githubusercontent.com/a1abc32ef454f1a55dd08ce921faf77b099721c749ed462fadf4126a9737c6c2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6d6d6974732d73696e63652f6176746f2d6465762f6170702d6d6574726963732d6c61726176656c2f6c61746573742e7376673f7374796c653d666c61742d737175617265266d61784167653d313830)](https://github.com/avto-dev/app-metrics-laravel/commits)

Changes log can be [found here](https://github.com/avto-dev/app-metrics-laravel/blob/master/CHANGELOG.md).

Support
-------

[](#support)

[![Issues](https://camo.githubusercontent.com/633a8d15bba8d2d0f403a8c8c9986d22be92950a23d0018e67959d94f55db83d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6176746f2d6465762f6170702d6d6574726963732d6c61726176656c2e7376673f7374796c653d666c61742d737175617265266d61784167653d313830)](https://github.com/avto-dev/app-metrics-laravel/issues)[![Issues](https://camo.githubusercontent.com/9c8d9f475f651bfa6e6550eeb5b286125861961eba0f41cbea62669ad01f591a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d70722f6176746f2d6465762f6170702d6d6574726963732d6c61726176656c2e7376673f7374796c653d666c61742d737175617265266d61784167653d313830)](https://github.com/avto-dev/app-metrics-laravel/pulls)

If you will find any package errors, please, [make an issue](https://github.com/avto-dev/app-metrics-laravel/issues/new/choose) in current repository.

License
-------

[](#license)

This is open-sourced software licensed under the [MIT License](https://github.com/avto-dev/app-metrics-laravel/blob/master/LICENSE).

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance54

Moderate activity, may be stable

Popularity33

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~162 days

Recently: every ~411 days

Total

14

Last Release

319d ago

Major Versions

v1.0.1 → v2.0.02019-10-02

PHP version history (6 changes)v1.0.0PHP ^7.1.3

v2.3.0PHP ^7.2

v2.5.0PHP ^7.3 || ^8.0

v2.7.0PHP ^8.0

v2.8.0PHP ^8.1

v2.9.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6119929?v=4)[Eldario](/maintainers/eldario)[@eldario](https://github.com/eldario)

![](https://avatars.githubusercontent.com/u/52275?v=4)[Zaboday](/maintainers/zaboday)[@Zaboday](https://github.com/Zaboday)

---

Top Contributors

[![Reallife](https://avatars.githubusercontent.com/u/356993?v=4)](https://github.com/Reallife "Reallife (11 commits)")[![tarampampam](https://avatars.githubusercontent.com/u/7326800?v=4)](https://github.com/tarampampam "tarampampam (7 commits)")[![eldario](https://avatars.githubusercontent.com/u/6119929?v=4)](https://github.com/eldario "eldario (3 commits)")[![bend-is](https://avatars.githubusercontent.com/u/63018907?v=4)](https://github.com/bend-is "bend-is (2 commits)")[![Zaboday](https://avatars.githubusercontent.com/u/52275?v=4)](https://github.com/Zaboday "Zaboday (2 commits)")[![IlyaKislitsin](https://avatars.githubusercontent.com/u/26906044?v=4)](https://github.com/IlyaKislitsin "IlyaKislitsin (1 commits)")[![helloween141](https://avatars.githubusercontent.com/u/6762347?v=4)](https://github.com/helloween141 "helloween141 (1 commits)")[![gomzyakov](https://avatars.githubusercontent.com/u/1460709?v=4)](https://github.com/gomzyakov "gomzyakov (1 commits)")[![yurichechulin](https://avatars.githubusercontent.com/u/54947685?v=4)](https://github.com/yurichechulin "yurichechulin (1 commits)")[![IgorKorytin](https://avatars.githubusercontent.com/u/56302950?v=4)](https://github.com/IgorKorytin "IgorKorytin (1 commits)")

---

Tags

laravelmetricspackageprometheuslaravelMetricsprometheus

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/avto-dev-app-metrics-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/avto-dev-app-metrics-laravel/health.svg)](https://phpackages.com/packages/avto-dev-app-metrics-laravel)
```

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

74310.9M66](/packages/laravel-mcp)[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8425.3M87](/packages/laravel-doctrine-orm)[andreaselia/laravel-api-to-postman

Generate a Postman collection automatically from your Laravel API

1.0k586.2k3](/packages/andreaselia-laravel-api-to-postman)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
