PHPackages                             rapid7/r7insight\_php - 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. rapid7/r7insight\_php

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

rapid7/r7insight\_php
=====================

Logging library for use with the Insight Platform

1.0.1(5y ago)12.0k↓26.3%3MITPHPCI failing

Since Jul 9Pushed 1y ago38 watchersCompare

[ Source](https://github.com/rapid7/r7insight_php)[ Packagist](https://packagist.org/packages/rapid7/r7insight_php)[ RSS](/packages/rapid7-r7insight-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

r7insight\_php
==============

[](#r7insight_php)

With these simple steps you can send your PHP application logs to the Insight Platform.

- [r7insight\_php](#r7insight_php)
    - [Insight Platform Setup](#insight-platform-setup)
    - [Composer install](#composer-install)
    - [Parameter Setup](#parameter-setup)
    - [Adding a Custom Host Name and Host ID sent in your PHP log events](#adding-a-custom-host-name-and-host-id-sent-in-your-php-log-events)
    - [Code Setup](#code-setup)

Insight Platform Setup
----------------------

[](#insight-platform-setup)

Once you have made your account on the Insight platform, log in and use the "Quick Add" option in the "Add data" page to add a new log, using the Token TCP option.

The Log Token and data endpoint will be displayed.
The Log Token is a unique identifier for the log allowing for write-only access. Take note of these.

Composer install
----------------

[](#composer-install)

This package is also available on [Composer](https://packagist.org/packages/rapid7/r7insight_php).

You can install this package by doing the following:

```
$ composer require rapid7/r7insight_php
```

Parameter Setup
---------------

[](#parameter-setup)

Inside the `r7insight_php` folder, open `r7insight.php` and fill in the `LOG_TOKEN` parameter.

`LOG_TOKEN` is the token you copied earlier from the Insight Platform UI, and associates that logger with the log in Insight Platform.

In the `REGION` field, enter the region code - e.g. `us`, `eu`, `ca`, `au` etc.

You can also supply both of these by the use of environment variables with the same name -- `LOG_TOKEN` and `REGION`.

Adding a Custom Host Name and Host ID sent in your PHP log events
-----------------------------------------------------------------

[](#adding-a-custom-host-name-and-host-id-sent-in-your-php-log-events)

To set a custom Host Name that will appear in your PHP log events as Key / Value pairs:

Inside the `r7insight_php` folder, open `r7insight.php` and fill in the parameters as follows:

```
$HOST_NAME_ENABLED = true;

$HOST_NAME = "Custom_host_name_here";

$HOST_ID = "Custom_ID_here_12345";

```

The `$HOST_NAME` constant can be left as an empty string, and the library will automatically attempt to assign a host name from your local host machine and use that as the custom host name.

To set a custom Host ID that will appear in your PHP log events as Key / Value pairs: Enter a value instead of the empty string in `$HOST_ID = "";`
If no `$HOST_ID` is set and the empty string is left unaltered, no Host ID or Key / Value pairing will appear in your PHP logs.

If you want to send log events in JSON format, then set the `$USE_JSON` field to `true`. If you set it to `false`, then the logs will be sent in KVP (Key Value Pair) format.

Code Setup
----------

[](#code-setup)

Now you need to download/clone the library from GitHub and place the folder in your apps directory.

To use it in your code, enter the following lines, making changes accordingly if you place it in a different location.

```
require dirname(__FILE__) . './r7insight_php/r7insight.php';

// The following levels are available
$log->debug("Isn't that the fault of the voters?");
$log->info("That's because sometimes I go by my maiden name.");
$log->notice("Give me the strongest thing you got.");
$log->crit("Awfully big moustache.");
$log->error("Yeah, and when I find the guy that did it...");
$log->alert("That's ok. I sometimes go by my maiden name.");
$log->emerg("Every time I order out.");
```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

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

Total

2

Last Release

2136d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1c4b209c8c48896c8f62c95f7afd9aa54c3b7aa007758d2da8832c991fea0c9e?d=identicon)[InsightOpsTeam](/maintainers/InsightOpsTeam)

---

Top Contributors

[![simonirwin-r7](https://avatars.githubusercontent.com/u/12156460?v=4)](https://github.com/simonirwin-r7 "simonirwin-r7 (3 commits)")[![sbialkowski-r7](https://avatars.githubusercontent.com/u/54031852?v=4)](https://github.com/sbialkowski-r7 "sbialkowski-r7 (2 commits)")[![dshafranskiy-r7](https://avatars.githubusercontent.com/u/167208426?v=4)](https://github.com/dshafranskiy-r7 "dshafranskiy-r7 (1 commits)")[![atoolan-r7](https://avatars.githubusercontent.com/u/124147158?v=4)](https://github.com/atoolan-r7 "atoolan-r7 (1 commits)")[![pquinn-r7](https://avatars.githubusercontent.com/u/16612513?v=4)](https://github.com/pquinn-r7 "pquinn-r7 (1 commits)")[![fpedrini](https://avatars.githubusercontent.com/u/16778734?v=4)](https://github.com/fpedrini "fpedrini (1 commits)")[![cmckelvey-r7](https://avatars.githubusercontent.com/u/107039024?v=4)](https://github.com/cmckelvey-r7 "cmckelvey-r7 (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rapid7-r7insight-php/health.svg)

```
[![Health](https://phpackages.com/badges/rapid7-r7insight-php/health.svg)](https://phpackages.com/packages/rapid7-r7insight-php)
```

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/packages/psr-log)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[graylog2/gelf-php

A php implementation to send log-messages to a GELF compatible backend like Graylog2.

41838.2M138](/packages/graylog2-gelf-php)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[consolidation/log

Improved Psr-3 / Psr\\Log logger based on Symfony Console components.

15462.2M7](/packages/consolidation-log)[ekino/newrelic-bundle

Integrate New Relic into Symfony2

28111.2M8](/packages/ekino-newrelic-bundle)

PHPackages © 2026

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