PHPackages                             middleware/laravel-apm - 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. middleware/laravel-apm

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

middleware/laravel-apm
======================

Middleware integration for Laravel

v1.0.1(1y ago)01.2k2PHPPHP ^7.3|^8.0|^8.1CI failing

Since Aug 8Pushed 1y ago3 watchersCompare

[ Source](https://github.com/middleware-labs/laravel-apm)[ Packagist](https://packagist.org/packages/middleware/laravel-apm)[ RSS](/packages/middleware-laravel-apm/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (7)Used By (0)

Laravel APM
===========

[](#laravel-apm)

This guide will walk you through the process of installing and configuring our Laravel apm package in your project.

Prerequisites
-------------

[](#prerequisites)

- Laravel project (version 8.x or higher recommended)
- Composer
- PHP 7.4 or higher

Installation
------------

[](#installation)

To install the package, follow these steps:

1. Install the package using Composer:

    ```
    composer require Middleware/laravel-apm
    ```
2. Add the service provider to the `providers` array in `config/app.php`:

    ```
    'providers' => [
        // ...
        Middleware\LaravelApm\LaravelApmServiceProvider::class,
    ],
    ```

Configuration
-------------

[](#configuration)

1. This package uses following environment variables:

- `MW_TARGET` or `OTEL_EXPORTER_OTLP_ENDPOINT`: The endpoint for middleware agent (default: ), in container environment it might be `:9320`.
- `MW_SERVICE_NAME` or `OTEL_SERVICE_NAME`: The name of your service (default: service-&lt;process\_id&gt;)
- `OTEL_EXPORTER_OTLP_PROTOCOL`: The protocol that you want to use for exporting data to provided target. (default: http/json)

2. Update your `.env` file with the appropriate values:

    ```
    MW_SERVICE_NAME=your-service-name
    ```

Make sure to set the appropriate values for your OpenTelemetry collector setup.

Tracing (Deprecated)
--------------------

[](#tracing-deprecated)

**Note**: This way of tracing is deprecated, please use this [script](https://install.middleware.io/apm/php/laravel-instrument.php) for tracing.

Laravel APM provides a middleware class to enable tracing. To register the tracing middleware, follow these steps:

1. Open `app/Http/Kernel.php` file.
2. Add the middleware to `$middleware` array:

    ```
    protected $middleware = [
        // ...
        \Middleware\LaravelApm\Middleware\TracingMiddleware::class,
    ];
    ```

Logging
-------

[](#logging)

The package integrates with Laravel's logging system to capture and export logs. The logs will be sent to the configured OpenTelemetry collector. To enable logging, make sure you have configured the appropriate log driver and settings in your Laravel application. The package will automatically capture and export the logs to the OpenTelemetry collector.

Metrics
-------

[](#metrics)

As of now, there's very little support for metrics, We'll be adding more metrics in future. For enabling traces-related metrics, follow these steps:

1. Open `app/Http/Kernel.php` file.
2. Add the middleware to `$middleware` array:

    ```
    protected $middleware = [
        // ...
        \Middleware\LaravelApm\Middleware\MetricsMiddleware::class,
    ];
    ```
3. If you have enabled tracing, then add this middleware after tracing.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance47

Moderate activity, may be stable

Popularity17

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 63.6% of commits — single point of failure

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 ~81 days

Total

3

Last Release

422d ago

Major Versions

0.0.2 → 1.0.02024-10-02

### Community

Maintainers

![](https://www.gravatar.com/avatar/ebc3e9bfe9eb106c82e5044891bc681d16459a3a282686a22f46331f946d7c0f?d=identicon)[middleware](/maintainers/middleware)

---

Top Contributors

[![hardik-choksi](https://avatars.githubusercontent.com/u/163282335?v=4)](https://github.com/hardik-choksi "hardik-choksi (7 commits)")[![bhogayatakb](https://avatars.githubusercontent.com/u/90185475?v=4)](https://github.com/bhogayatakb "bhogayatakb (4 commits)")

### Embed Badge

![Health badge](/badges/middleware-laravel-apm/health.svg)

```
[![Health](https://phpackages.com/badges/middleware-laravel-apm/health.svg)](https://phpackages.com/packages/middleware-laravel-apm)
```

###  Alternatives

[guanguans/laravel-exception-notify

Monitor exception and report to the notification channels(Log、Mail、AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

14642.7k1](/packages/guanguans-laravel-exception-notify)[codecov/laravel-codecov-opentelemetry

Laravel middleware for Codecov's OpenTelemetry

54240.8k](/packages/codecov-laravel-codecov-opentelemetry)[open-telemetry/symfony-sdk-bundle

OpenTelemetry Symfony integration

1182.6k4](/packages/open-telemetry-symfony-sdk-bundle)

PHPackages © 2026

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