PHPackages                             mattferris/logging - 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. mattferris/logging

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

mattferris/logging
==================

A PHP logger

1.0(1y ago)0431PHP

Since Nov 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mattferris/logging)[ Packagist](https://packagist.org/packages/mattferris/logging)[ RSS](/packages/mattferris-logging/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (3)Versions (3)Used By (1)

Logging
-------

[](#logging)

A PSR-3 compliant logger.

Log to a file
-------------

[](#log-to-a-file)

```
use MattFerris\Logging\Logger;
use MattFerris\Logging\Handlers\FileHandler;

$logger = new Logger([
    ['handler' => new FileHandler('log.txt')]
]);

$logger->error('an error occured');
```

In the above case, all log messages will recorded in the log file. To isolate one or more log level's specifically, you can specify a `levels` key when passing the handler.

```
use MattFerris\Logging\Logger;
use MattFerris\Logging\Handlers\FileHandler;
use Psr\Log\LogLevel;

$logger = new Logger([
    [
        'handler' => new FileHandler('log.txt'),
        'levels' => [ LogLevel::EMERGENCY, LogLevel::CRITICAL, LogLevel::ERROR ]
    ]
]);
```

It's also possible to specify a `maxlevel` key so the handler will record everything up to a specific level. The above example could be simplied like so:

```
$logger = new Logger([
    [
        'handler' => new FileHandler('log.txt'),
        'maxlevel' => LogLevel::ERROR
    ]
]);
```

Multiple handlers can be used to log to multiple destinations. This could be used to record different log levels to different files, or even a file and a database. Currently, only the `FileHandler` is included, but any `callable`or class implementing `MattFerris\Logging\Handlers\HandlerInterface` can be used.

Log message placeholders
------------------------

[](#log-message-placeholders)

As per PSR-3, placeholders can be used in log messages that are then populated using the corresponding key in the provided `$context` array.

```
$logger->error('the user {user} does not exist', ['user' => 'joe']);
```

This would result in the log message `the user joe does not exist`. This substitution is handled by the `InterpolationHelper` helper class.

```
use MattFerris\Logging\Helpers\InterpolationHelper;

$logger = new Logger($handlers, [ new InterpolationHelper() ]);
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~2397 days

Total

2

Last Release

715d ago

Major Versions

0.1 → 1.02024-05-29

### Community

Maintainers

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

---

Top Contributors

[![mattferris](https://avatars.githubusercontent.com/u/1687325?v=4)](https://github.com/mattferris "mattferris (5 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mattferris-logging/health.svg)

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

###  Alternatives

[sentry/sentry

PHP SDK for Sentry (http://sentry.io)

1.9k227.1M273](/packages/sentry-sentry)[rollbar/rollbar

Monitors errors and exceptions and reports them to Rollbar

33723.7M82](/packages/rollbar-rollbar)[illuminate/log

The Illuminate Log package.

6224.3M518](/packages/illuminate-log)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2222.9M248](/packages/open-telemetry-sdk)[open-telemetry/api

API for OpenTelemetry PHP.

1833.0M214](/packages/open-telemetry-api)[pagemachine/typo3-formlog

Form log for TYPO3

23225.3k6](/packages/pagemachine-typo3-formlog)

PHPackages © 2026

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