PHPackages                             centagon/papertrail - 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. centagon/papertrail

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

centagon/papertrail
===================

Integrate Papertrail log monitor in your PHP applications

9.1.0(6mo ago)02.8kMITPHPPHP 8.4.\*

Since Nov 1Pushed 6mo ago2 watchersCompare

[ Source](https://github.com/centagon/papertrail)[ Packagist](https://packagist.org/packages/centagon/papertrail)[ RSS](/packages/centagon-papertrail/feed)WikiDiscussions master Synced today

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

Papertrail PHP Connector
========================

[](#papertrail-php-connector)

[![Build Status](https://camo.githubusercontent.com/4e72c9348e5692cff731501f4d8c5145993a191450413a84d862bc27bcc6d5c8/68747470733a2f2f7472617669732d63692e6f72672f7374657068616e65636f696e6f6e2f7061706572747261696c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/stephanecoinon/papertrail)

Easily integrate [Papertrail log monitor](https://papertrailapp.com) in your PHP applications. This package provides integration for plain vanilla PHP and Laravel.

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

[](#installation)

```
composer require centagon/papertrail
```

Configuration
-------------

[](#configuration)

It is good practice *not* to include credentials in your code so passwords are not stored in version control. Keeping sensitive info in your code could become an issue when you need to open source or share your code with other developers. For this reason, this package will get your papertrail log server details from environment variables `PAPERTRAIL_HOST`, `PAPERTRAIL_PORT` and `PAPERTRAIL_HOSTNAME` by default.

This package ships with 2 drivers:

- `Php` for plain PHP applications
- `Laravel` for Laravel applications from version 4.2 to 5.6

### Plain Vanilla PHP

[](#plain-vanilla-php)

For plain PHP applications, we recommend also installing [Monolog](https://github.com/Seldaek/monolog):

```
composer require monolog/monolog
```

then integrate the papertrail package like so:

```
require __DIR__ . '/vendor/autoload.php';

use StephaneCoinon\Papertrail\Php as Papertrail;

// Boot using default settings (ie Papertrail log server and port
// from environment variables and no log message prefix).
// It also gives you a monolog instance in the process.
$logger = Papertrail::boot();

// Now your logs will appear in Papertrail dashboard.
$logger->info('test log');
```

### Laravel 4

[](#laravel-4)

Add these lines in your `start/global.php`:

```
// Pass all parameters
\StephaneCoinon\Papertrail\Laravel::boot($host, $port, $prefix);
```

or

```
// Grab log server details from environment variables and use a prefix
\StephaneCoinon\Papertrail\Laravel::bootWithPrefix('MY_APP');
```

### Laravel 5

[](#laravel-5)

Edit `app/Providers/AppServiceProvider.php` and add this line in `boot` method:

```
\StephaneCoinon\Papertrail\Laravel::boot();
```

then test it's working:

```
// routes/web.php

Route::get('log', function () {
    Log::info('test log', ['foo' => 'bar']);

    return 'Logged';
});
```

API reference
-------------

[](#api-reference)

All drivers provide the following interface:

```
/**
 * Boot connector with given host, port and log message prefix.
 *
 * If host or port are omitted, we'll try to get them from the environment
 * variables PAPERTRAIL_HOST and PAPERTRAIL_PORT.
 *
 * @param  string $host   Papertrail log server, ie log.papertrailapp.com
 * @param  int $port      Papertrail port number for log server
 * @param  string $prefix Prefix to use for each log message
 * @return \Psr\Log\LoggerInterface
 */
public static function boot($host = null, $port = null, $prefix = '')
```

```
/**
 * Boot connector using credentials set in environment variables and the
 * given log message prefix.
 *
 * @param string $prefix Prefix to use for each log message
 * @return \Psr\Log\LoggerInterface
 */
public static function bootWithPrefix($prefix)
```

Tests
-----

[](#tests)

First, copy `.env.dist` as `.env` and set your Papertrail host, port and API key in it.

Then run PHPUnit:

```
./vendor/bin/phpunit
```

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance66

Regular maintenance activity

Popularity18

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity88

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 66.7% 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 ~410 days

Recently: every ~612 days

Total

10

Last Release

200d ago

Major Versions

v1.1.3 → 9.0.02019-04-01

v6.2.1 → 9.0.12022-05-25

PHP version history (3 changes)1.0PHP &gt;=5.4

9.0.1PHP 8.1.\*

9.1.0PHP 8.4.\*

### Community

Maintainers

![](https://www.gravatar.com/avatar/e50c877848f1470a2f033630d2408a88c90cbf86dfe5d8b74a0845f92ec9e672?d=identicon)[renecentagon](/maintainers/renecentagon)

---

Top Contributors

[![reneheijnemans](https://avatars.githubusercontent.com/u/34155800?v=4)](https://github.com/reneheijnemans "reneheijnemans (2 commits)")[![ReneHRich](https://avatars.githubusercontent.com/u/108719031?v=4)](https://github.com/ReneHRich "ReneHRich (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/centagon-papertrail/health.svg)

```
[![Health](https://phpackages.com/badges/centagon-papertrail/health.svg)](https://phpackages.com/packages/centagon-papertrail)
```

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B11.5k](/packages/psr-log)[open-telemetry/api

API for OpenTelemetry PHP.

1941.5M276](/packages/open-telemetry-api)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2328.5M343](/packages/open-telemetry-sdk)

PHPackages © 2026

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