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 today

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

33

—

LowBetter than 72% of packages

Maintenance42

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity53

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

478d ago

Major Versions

0.0.2 → 1.0.02024-10-02

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1130078?v=4)[Middleware](/maintainers/middleware)[@Middleware](https://github.com/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

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[laravel/nightwatch

The official Laravel Nightwatch package.

36210.1M36](/packages/laravel-nightwatch)[keepsuit/laravel-opentelemetry

OpenTelemetry integration for laravel

167558.4k1](/packages/keepsuit-laravel-opentelemetry)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135224.7k7](/packages/statamic-rad-pack-runway)[api-platform/laravel

API Platform support for Laravel

58171.5k14](/packages/api-platform-laravel)[nightowl/agent

NightOwl monitoring agent — collects telemetry from laravel/nightwatch and writes to PostgreSQL

771.7k](/packages/nightowl-agent)

PHPackages © 2026

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