PHPackages                             lupferjoel/lumen-newrelic - 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. lupferjoel/lumen-newrelic

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

lupferjoel/lumen-newrelic
=========================

New Relic instrumentation for the Lumen framework

5.0.0(4y ago)01.4kMITPHPPHP ^7.2 | ^8.0

Since Dec 9Pushed 3y agoCompare

[ Source](https://github.com/lupferjoel/lumen-newrelic)[ Packagist](https://packagist.org/packages/lupferjoel/lumen-newrelic)[ RSS](/packages/lupferjoel-lumen-newrelic/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (5)Versions (14)Used By (0)

lumen-newrelic
==============

[](#lumen-newrelic)

[![GitHub Actions status](https://github.com/digiaonline/lumen-newrelic/workflows/Test/badge.svg)](https://github.com/digiaonline/lumen-newrelic/actions)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/acc628f869059ea3662c912a7300d21b27c524b0e2e2cf405df7480308680587/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f64696769616f6e6c696e652f6c756d656e2d6e657772656c69632f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/digiaonline/lumen-newrelic/?branch=master)[![Coverage Status](https://camo.githubusercontent.com/7127538c9283001081f02d1178610f5f5dad1c1257a4e9cdbfe67b77e2534506/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f64696769616f6e6c696e652f6c756d656e2d6e657772656c69632f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/digiaonline/lumen-newrelic?branch=master)

This library provides New Relic instrumentation for the Lumen framework. When installed this library will ensure that your transactions are properly named and that your exceptions are properly logged in New Relic.

Requirements
------------

[](#requirements)

- PHP &gt;= 7.2
- [Composer](http://getcomposer.org)
- [Lumen](https://lumen.laravel.com/) 5.5 or newer

Usage
-----

[](#usage)

### Installation

[](#installation)

Run the following command to install the package through Composer:

```
composer require nordsoftware/lumen-newrelic
```

### Configuration

[](#configuration)

You don't have to set any config values if you are happy to rely on the content of your `newrelic.ini` file. However, it's possible to override the license and application name using environment variables or the `.env` file. This can be useful if you deploy the same app in multiple environments, and therefore need distinguished names for each.

Be aware that doing so can have a [small performance impact](https://github.com/In-Touch/newrelic/blob/5dc4eb7a25731f92cdbfb7a094a788cf137df40e/src/Newrelic.php#L82-L87) on the app.

The environment variables available are:

- `NEW_RELIC_OVERRIDE_INI` (defaults to `false`)
- `NEW_RELIC_APP_NAME`
- `NEW_RELIC_LICENSE_KEY`

If you don't set `NEW_RELIC_OVERRIDE_INI` to `true`, the app will not override the `newrelic.ini` file, regardless of the value of the other two variables.

Check out the description in `/config/newRelic.php` for an explanation of the effect.

### Bootstrapping

[](#bootstrapping)

In `bootstrap/app.php`, replace the `$app->singleton()` call which registers the exception handler with the following snippet:

```
$app->instance(
    Illuminate\Contracts\Debug\ExceptionHandler::class,
    new Nord\Lumen\ChainedExceptionHandler\ChainedExceptionHandler(
        new \App\Exceptions\Handler(),
        [new Nord\Lumen\NewRelic\NewRelicExceptionHandler()]
    )
);
```

This will ensure that exceptions are correctly reported to New Relic.

Now, add the middleware too:

```
$app->middleware([
	...
	Nord\Lumen\NewRelic\NewRelicMiddleware::class,
]);
```

This will ensure that transactions are named properly.

Finally, register the service provider:

```
$app->register(Nord\Lumen\NewRelic\NewRelicServiceProvider::class);
```

Ignoring certain exceptions
---------------------------

[](#ignoring-certain-exceptions)

By default the exception handler ignores exceptions of type `Symfony\Component\HttpKernel\Exception\NotFoundHttpException`. You can customize the list of ignored exceptions by passing an array to the exception handler's constructor:

```
$exceptionHandler = new Nord\Lumen\NewRelic\NewRelicExceptionHandler([
	FooException::class,
	BarException::class,
]);
```

If you don't want any exception to be ignored, pass an empty array to the constructor.

Customizing transaction names
-----------------------------

[](#customizing-transaction-names)

By default the transaction name will use the `controller@action` assigned to the route. If that fails, it will use the route's name. If no name is defined, it will fallback to just `index.php`.

If this doesn't meet your requirements, extend the `Nord\Lumen\NewRelic\NewRelicMiddleware` class and override the `getTransactionName()` method, then register that middleware class instead.

Marking transactions as background jobs
---------------------------------------

[](#marking-transactions-as-background-jobs)

If you have a dedicated route for webhooks, notifications, or other long-running background tasks you can apply the `Nord\Lumen\NewRelic\NewRelicBackgroundJobMiddleware` to the route in question. This will mark the transaction as a background job in New Relic so that long processing times don't skew your response time graphs.

Running tests
-------------

[](#running-tests)

Clone the project and install its dependencies by running:

```
composer install
```

Run the following command to run the test suite:

```
vendor/bin/phpunit
```

License
-------

[](#license)

See [LICENSE](LICENSE)

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity75

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

Recently: every ~128 days

Total

13

Last Release

1585d ago

Major Versions

1.1.2 → 2.0.12019-03-05

1.1.3 → 2.0.22019-12-03

2.0.2 → 3.0.02020-10-05

3.1.1 → 4.0.02021-11-12

4.0.0 → 5.0.02022-03-03

PHP version history (4 changes)1.0.0PHP &gt;=5.6.4

2.0.0PHP ^7.1

3.0.0PHP ^7.2

4.0.0PHP ^7.2 | ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/54706581?v=4)[Joel Lupfer](/maintainers/lupferjoel)[@lupferjoel](https://github.com/lupferjoel)

---

Top Contributors

[![hugovk](https://avatars.githubusercontent.com/u/1324225?v=4)](https://github.com/hugovk "hugovk (10 commits)")[![Jalle19](https://avatars.githubusercontent.com/u/1106133?v=4)](https://github.com/Jalle19 "Jalle19 (9 commits)")[![miff2000](https://avatars.githubusercontent.com/u/3526189?v=4)](https://github.com/miff2000 "miff2000 (9 commits)")[![ls-renaud-tilte](https://avatars.githubusercontent.com/u/47116999?v=4)](https://github.com/ls-renaud-tilte "ls-renaud-tilte (3 commits)")[![ls-paul-julien-vauthier](https://avatars.githubusercontent.com/u/54601900?v=4)](https://github.com/ls-paul-julien-vauthier "ls-paul-julien-vauthier (2 commits)")[![lupferjoel](https://avatars.githubusercontent.com/u/54706581?v=4)](https://github.com/lupferjoel "lupferjoel (1 commits)")[![neclimdul](https://avatars.githubusercontent.com/u/82823?v=4)](https://github.com/neclimdul "neclimdul (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lupferjoel-lumen-newrelic/health.svg)

```
[![Health](https://phpackages.com/badges/lupferjoel-lumen-newrelic/health.svg)](https://phpackages.com/packages/lupferjoel-lumen-newrelic)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

87512.0M167](/packages/spatie-laravel-health)[illuminate/log

The Illuminate Log package.

6225.3M626](/packages/illuminate-log)[spatie/laravel-flare

Send Laravel errors to Flare

111.4M7](/packages/spatie-laravel-flare)

PHPackages © 2026

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