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

Abandoned → [arkaitzgarro/elastic-apm-laravel](/?search=arkaitzgarro%2Felastic-apm-laravel)ArchivedLibrary[Logging &amp; Monitoring](/categories/logging)

nipwaayoni/elastic-apm-laravel
==============================

A package to integrate Elastic APM into Laravel

v7.1.0(5y ago)934.6k↓50%4MITPHPPHP &gt;= 7.2

Since Jun 19Pushed 5y ago3 watchersCompare

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

READMEChangelog (3)Dependencies (3)Versions (18)Used By (0)

IMPORTANT!!! This package is abandoned
======================================

[](#important-this-package-is-abandoned)

This package is no longer being maintained. Please use

PHP Elastic APM for Laravel &amp; Lumen
=======================================

[](#php-elastic-apm-for-laravel--lumen)

[![Latest Stable Version](https://camo.githubusercontent.com/476676d20ef3c54388024e166665e2d8f04e36a12da89333cedfd9d220b1e145/68747470733a2f2f706f7365722e707567782e6f72672f6e6970776161796f6e692f656c61737469632d61706d2d6c61726176656c2f76)](//packagist.org/packages/nipwaayoni/elastic-apm-laravel)[![Total Downloads](https://camo.githubusercontent.com/6d64592798aee046bb54ca380242dc6269b78fcec863001033ff6266de806b38/68747470733a2f2f706f7365722e707567782e6f72672f6e6970776161796f6e692f656c61737469632d61706d2d6c61726176656c2f646f776e6c6f616473)](//packagist.org/packages/nipwaayoni/elastic-apm-laravel)[![Latest Unstable Version](https://camo.githubusercontent.com/cdf6e453349805f1578830cfe09cd55cf0fb99ebe4d6dd8cf0dfb4523110c7a8/68747470733a2f2f706f7365722e707567782e6f72672f6e6970776161796f6e692f656c61737469632d61706d2d6c61726176656c2f762f756e737461626c65)](//packagist.org/packages/nipwaayoni/elastic-apm-laravel)[![Build Status](https://github.com/nipwaayoni/elastic-apm-laravel/workflows/CI/badge.svg)](https://github.com/nipwaayoni/elastic-apm-laravel/actions?query=workflow%3ACI)[![License](https://camo.githubusercontent.com/da97f8fbcd540ec86e754c8b922b39ad5e5ab25f9de0a0d0545a9e30e2660aca/68747470733a2f2f706f7365722e707567782e6f72672f6e6970776161796f6e692f656c61737469632d61706d2d6c61726176656c2f6c6963656e7365)](//packagist.org/packages/nipwaayoni/elastic-apm-laravel)

Laravel package of the [nipwaayoni/elastic-apm-php-agent](https://github.com/nipwaayoni/elastic-apm-php-agent) library, automatically handling transactions and errors/exceptions. If using `Illuminate\Support\Facades\Auth` the user Id added to the context. Tested with Laravel `5.6.*` and the nipwaayoni/elastic-apm-php-agent version `7.1.*`.

This package is a continuation of the excellent work done by [philkra](https://github.com/philkra) at [philkra/elastic-apm-laravel](https://github.com/philkra/elastic-apm-laravel).

Install
-------

[](#install)

```
composer require nipwaayoni/elastic-apm-laravel

```

The [nipwaayoni/elastic-apm-php-agent](https://github.com/nipwaayoni/elastic-apm-php-agent) no longer includes and http client. You must ensure a [PSR-18](https://www.php-fig.org/psr/psr-18/) compatible implementation is available. Please see the [agent install guide](https://github.com/nipwaayoni/elastic-apm-php-agent/blob/master/docs/install.md) for more information.

Service Provider
----------------

[](#service-provider)

### Laravel

[](#laravel)

If using Laravel &gt;=5.5, registration is done automatically by [package discovery](https://laravel.com/docs/7.x/packages#package-discovery).

This package is not tested or asserted to work with Laravel &lt;5.5.

### Lumen

[](#lumen)

In `bootstrap/app.php` register `\Nipwaayoni\ElasticApmLaravel\Providers\ElasticApmServiceProvider::class` as service provider:

```
$app->register(\Nipwaayoni\ElasticApmLaravel\Providers\ElasticApmServiceProvider::class);
```

Middleware
----------

[](#middleware)

### Laravel

[](#laravel-1)

Register as (e.g.) global middleware to be called with every request.

Register the middleware in `app/Http/Kernel.php`

```
protected $middleware = [
    // ... more middleware
    \Nipwaayoni\ElasticApmLaravel\Middleware\RecordTransaction::class,
];
```

#### Customizing Transactions

[](#customizing-transactions)

The provided middleware adds request and response context data to the transaction. If the existing behavior does not suit your needs, you can provide your own middleware by overriding the class. See the documentation on [customizing transactions](docs/customizing_transactions.md) for more information.

### Lumen

[](#lumen-1)

In `bootstrap/app.php` register `Nipwaayoni\ElasticApmLaravel\Middleware\RecordTransaction::class` as middleware:

```
$app->middleware([
    Nipwaayoni\ElasticApmLaravel\Middleware\RecordTransaction::class
]);
```

Events
------

[](#events)

The Elastic APM service supports a variety of event types. This package currently supports only a subset as described here.

### Transaction Event

[](#transaction-event)

The `RecordTransaction` middleware automatically starts a new Transaction for the current HTTP Request. All additional events will be descendents of this transaction.

There is currently no provision to manage additional Transaction events, or to handle a non-HTTP Request based process. We hope to address those issues in a future release.

#### Customizing Transaction Context

[](#customizing-transaction-context)

While the `RecordTransaction` middleware sets supported APM contexts when the transaction is created, you may wish to customize the contexts based on the completed request/response. This can be done by extending the `RecordTransaction` middleware and overriding context methods as described in the [customizing transactions](docs/customizing_transactions.md) documentation.

#### Excluding Requests

[](#excluding-requests)

You can exclude requests from being sent to APM by using an `except` list of URI patterns. For example, you may wish to avoid sending requests for the (DebugBar)\[\] resources during development or testing.

Add the desired URI patterns to the `except` key in the `elastic-apm` configuration. Note that you must publish the file as described in the [configuration docs](docs/configuration.md).

If you have extended the `RecordTransaction` middleware, as described in the [customizing transactions](docs/customizing_transactions.md) documentation, you may set the `except` list class member there.

### Span Events

[](#span-events)

Spans occur within a Transaction. Spans represent events within the Transaction. Queries made through Laravel's database layer are automatically added to the Transaction. You can add your own Span events using the `EventTimer`class from this package. See the docs for [creating spans](docs/creating_spans.md).

Nested Spans are not supported by this package yet.

### Error Events

[](#error-events)

The APM service defines exception events as a valid type. Exceptions in your application can be sent to APM in addition to any normal exception handling. See the docs for [exceptions](docs/exceptions.md).

Agent Configuration
-------------------

[](#agent-configuration)

You can use a number of environment settings to influence the behavior of this package. At a minimum, you must set the APM server URL and, if applicable, the secret toke:

VariableDescriptionAPM\_SERVERURLURL to the APM intake service.APM\_SECRETTOKENSecret token, if required.Refer to the [configuration docs](docs/configuration.md) for more information.

### HTTP Client Customization

[](#http-client-customization)

It is no longer possible to provide HTTP client options through the APM PHP Agent configuration. If you need to customize the HTTP client, you must implement and configure a suitable client object and provide it to the `AgentBuilder`. See the "HTTP Client Configuration" section of the [configuration docs](docs/configuration.md).

Laravel Test Setup
------------------

[](#laravel-test-setup)

Laravel provides classes to support running unit and feature tests with PHPUnit. In most cases, you will want to explicitly disable APM during testing since it is enabled by default. Refer to the Laravel documentation for more information ().

Because the APM agent checks its active status using a strict boolean type, you must ensure your `APM_ACTIVE` value is a boolean `false` rather than simply a falsy value. The best way to accomplish this is to create an `.env.testing` file and include `APM_ACTIVE=false`, along with any other environment settings required for your tests. This file should be safe to include in your SCM.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity66

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

Recently: every ~71 days

Total

17

Last Release

2145d ago

Major Versions

v5.8.2 → 6.0.02019-09-23

v6.0.1 → v7.0.02020-06-18

PHP version history (2 changes)5.6.0PHP &gt;= 7.0

6.0.0PHP &gt;= 7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e0a699d847780b1b2e12f6071d1e4e09c86f23c4c51845653eb687dd4cfd325?d=identicon)[dstepe](/maintainers/dstepe)

---

Top Contributors

[![dstepe](https://avatars.githubusercontent.com/u/2804725?v=4)](https://github.com/dstepe "dstepe (47 commits)")[![philkra](https://avatars.githubusercontent.com/u/35487337?v=4)](https://github.com/philkra "philkra (24 commits)")[![tepeds](https://avatars.githubusercontent.com/u/162032891?v=4)](https://github.com/tepeds "tepeds (19 commits)")[![georgeboot](https://avatars.githubusercontent.com/u/884482?v=4)](https://github.com/georgeboot "georgeboot (18 commits)")[![mpetrunic](https://avatars.githubusercontent.com/u/8836210?v=4)](https://github.com/mpetrunic "mpetrunic (5 commits)")[![jblotus](https://avatars.githubusercontent.com/u/382230?v=4)](https://github.com/jblotus "jblotus (3 commits)")[![petermein](https://avatars.githubusercontent.com/u/311652?v=4)](https://github.com/petermein "petermein (3 commits)")[![AlexGodbehere](https://avatars.githubusercontent.com/u/114239316?v=4)](https://github.com/AlexGodbehere "AlexGodbehere (2 commits)")[![jcalonso](https://avatars.githubusercontent.com/u/664474?v=4)](https://github.com/jcalonso "jcalonso (2 commits)")[![YuZhenXie](https://avatars.githubusercontent.com/u/5066215?v=4)](https://github.com/YuZhenXie "YuZhenXie (1 commits)")[![ibrahim-sakr](https://avatars.githubusercontent.com/u/3674316?v=4)](https://github.com/ibrahim-sakr "ibrahim-sakr (1 commits)")[![JustSteveKing](https://avatars.githubusercontent.com/u/6368379?v=4)](https://github.com/JustSteveKing "JustSteveKing (1 commits)")[![mfairch](https://avatars.githubusercontent.com/u/2048552?v=4)](https://github.com/mfairch "mfairch (1 commits)")[![montross50](https://avatars.githubusercontent.com/u/62939?v=4)](https://github.com/montross50 "montross50 (1 commits)")[![thinkspill](https://avatars.githubusercontent.com/u/822133?v=4)](https://github.com/thinkspill "thinkspill (1 commits)")

---

Tags

laravelmonitoringdebuglumenapmelastic

### Embed Badge

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

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

###  Alternatives

[arkaitzgarro/elastic-apm-laravel

Laravel APM agent for Elastic v2 intake API

84433.6k](/packages/arkaitzgarro-elastic-apm-laravel)[tobiasdierich/gauge

An easy to use application performance monitor.

14413.1k](/packages/tobiasdierich-gauge)

PHPackages © 2026

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