PHPackages                             nagi/laravel-newrelic-log-api - 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. nagi/laravel-newrelic-log-api

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

nagi/laravel-newrelic-log-api
=============================

This is my package laravel-newrelic-log-api

v1.1.0(2mo ago)2562MITPHPPHP ^8.3CI passing

Since Sep 9Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/nagi1/laravel-newrelic-log-api)[ Packagist](https://packagist.org/packages/nagi/laravel-newrelic-log-api)[ Docs](https://github.com/nagi1/laravel-newrelic-log-api)[ GitHub Sponsors](https://github.com/nagi1)[ RSS](/packages/nagi-laravel-newrelic-log-api/feed)WikiDiscussions main Synced yesterday

READMEChangelog (8)Dependencies (19)Versions (11)Used By (0)

New Relic Log API for Laravel
=============================

[](#new-relic-log-api-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1f69116761c102eef6c6ef7eddd6ff602870bd6d2ea63722818b92fac4a15915/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6167692f6c61726176656c2d6e657772656c69632d6c6f672d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nagi/laravel-newrelic-log-api)[![GitHub Tests Action Status](https://camo.githubusercontent.com/2d9e576da2cbfc71586ec3f32b99792fd03b8b17630a937a99e57e6152a9c6dc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6e616769312f6c61726176656c2d6e657772656c69632d6c6f672d6170692f72756e2d74657374732e796d6c3f6272616e63683d646576266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/nagi1/laravel-newrelic-log-api/actions?query=workflow%3Arun-tests+branch%3Adev)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/b102d3918a651b28e8df9d814e070d8a9a2079e3b1566cefad11e85ac538714a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6e616769312f6c61726176656c2d6e657772656c69632d6c6f672d6170692f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d646576266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/nagi1/laravel-newrelic-log-api/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Adev)[![Total Downloads](https://camo.githubusercontent.com/876f52cfb90b82c24caeefeb8b5a9c320abc91648dce833636fa0aa2a2337d7e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6167692f6c61726176656c2d6e657772656c69632d6c6f672d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nagi/laravel-newrelic-log-api)

Integrate New Relic Log API with Laravel your laravel application. It mainly utilizing queues behind the scene to send the logs to New Relic API. so make sure you have queue worker running.

Supports Laravel 11, 12, and 13 on PHP 8.3+.

```
    // in loggin.php
    'stack' => [
                'driver' => 'stack',
                'channels' => ['single', 'newrelic-log-api'],
                'ignore_exceptions' => false,
            ],

        //...
        'newrelic-log-api' => [
            'driver' => 'monolog',
            'handler' => \Nagi\LaravelNewrelicLogApi\LaravelNewrelicLogApi::logHandler(),
            'level' => 'debug',
        ],
```

```
logger('newrelic-log-api')->info('Hey Mom!');

// or if you are using stack

logger()->info('Hey Mom!');
```

Support Me
----------

[](#support-me)

Does your business depend on my contributions? Reach out and support me on [PayPal](https://www.paypal.com/paypalme/nagix1). All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff.

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

[](#installation)

You can install the package via composer:

```
composer require nagi/laravel-newrelic-log-api
```

For local package development, Laravel Boost is available as a dev dependency.

You can publish the config file with:

```
php artisan vendor:publish --tag="laravel-newrelic-log-api-config"
```

This is the contents of the published config file:

```
return [
    'enabled' => env('NEWRELIC_ENABLED', false),

    /**
     * New Relic API key or License key
     *
     * @see https://docs.newrelic.com/docs/logs/log-api/introduction-log-api/#setup
     */
    'api_key' => env('NEWRELIC_API_KEY'),

    /**
     * The base URL for the new relic log API
     *
     * @see https://docs.newrelic.com/docs/logs/log-api/introduction-log-api/#endpoint
     */
    'base_url' => env('NEWRELIC_BASE_URL', 'https://log-api.eu.newrelic.com'),

    /**
     * The minimum logging level at which this handler will be triggered
     */
    'level' => env('NEWRELIC_LEVEL', 'debug'),

    /**
     * Retry sending the log to New Relic API
     */
    'retry' => env('NEWRELIC_RETRY', 3),

    /**
     * Delay between retries in milliseconds
     */
    'retry_delay' => env('NEWRELIC_RETRY_DELAY', 1000),

    /**
     * Queue name to use for sending logs to New Relic API
     */
    'queue' => env('NEWRELIC_QUEUE', 'default'),

    /**
     * Log handler to use for sending logs to New Relic API
     */
    'log_handler' => \Nagi\LaravelNewrelicLogApi\NewrelicLogHandler::class,
];
```

**🚨 Make sure that you have queue worker configured.**

Usage
-----

[](#usage)

### Get your newrelic License/API

[](#get-your-newrelic-licenseapi)

### Add env values in your .env

[](#add-env-values-in-your-env)

```
NEWRELIC_ENABLED=true
NEWRELIC_API_KEY=

# if your account is not EU change the baseurl
# https://log-api.newrelic.com/log/v1
NEWRELIC_BASE_URL=https://log-api.eu.newrelic.com

```

### Add new relic channel to your config

[](#add-new-relic-channel-to-your-config)

In your `logging.php` add `new-relic-log-api` channel

```
        'newrelic-log-api' => [
            'driver' => 'monolog',
            'handler' => \Nagi\LaravelNewrelicLogApi\LaravelNewrelicLogApi::logHandler(),
            'level' => env('NEWRELIC_LEVEL', 'debug')
        ],
```

### Add it to your logging stack

[](#add-it-to-your-logging-stack)

in `logging.php`

```
    'stack' => [
                'driver' => 'stack',
                'channels' => ['single', 'newrelic-log-api'],
                'ignore_exceptions' => false,
            ],
```

Listen to the event
-------------------

[](#listen-to-the-event)

If you are intrested in geting the response from the New Relic API you can listen to the event `NewrelicLogApiResponseEvent` It will have the status and the response from the API.

```
    protected $listen = [
        NewrelicLogApiResponseEvent::class => [
            NewrelicLogApiResponseListener::class,
        ],
    ];
```

Note on context log (attributes)
--------------------------------

[](#note-on-context-log-attributes)

When sending one of the following attributes in the context it will be prefixed with `attr_` to avoid overriding the whole message.

See: [New Relic Log API](https://docs.newrelic.com/docs/logs/log-api/introduction-log-api/#attributes)

Extending
---------

[](#extending)

All of the classes in this package are loaded via Laravel's service container meaning you can easily replace them with your own implementation. On Your Own Risk.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Ahmed Nagi](https://github.com/nagi1)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance86

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 96.4% 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 ~84 days

Recently: every ~148 days

Total

8

Last Release

71d ago

PHP version history (2 changes)v1.0.0PHP ^8.2

v1.1.0PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1297635?v=4)[Andrew Nagi](/maintainers/nagi)[@nagi](https://github.com/nagi)

---

Top Contributors

[![nagi1](https://avatars.githubusercontent.com/u/16584220?v=4)](https://github.com/nagi1 "nagi1 (54 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (2 commits)")

---

Tags

laravelAhmed Nagilaravel-newrelic-log-api

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/nagi-laravel-newrelic-log-api/health.svg)

```
[![Health](https://phpackages.com/badges/nagi-laravel-newrelic-log-api/health.svg)](https://phpackages.com/packages/nagi-laravel-newrelic-log-api)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

87512.0M164](/packages/spatie-laravel-health)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[nativephp/mobile

NativePHP for Mobile

1.1k75.1k91](/packages/nativephp-mobile)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5021.9k](/packages/simplestats-io-laravel-client)[keepsuit/laravel-opentelemetry

OpenTelemetry integration for laravel

167558.4k1](/packages/keepsuit-laravel-opentelemetry)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)

PHPackages © 2026

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