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(2y ago)0431PHP

Since Nov 4Pushed 2y ago1 watchersCompare

[ Source](https://github.com/mattferris/logging)[ Packagist](https://packagist.org/packages/mattferris/logging)[ RSS](/packages/mattferris-logging/feed)WikiDiscussions master Synced 2w 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

28

—

LowBetter than 52% of packages

Maintenance20

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

762d 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

[symfony/cache

Provides extended PSR-6, PSR-16 (and tags) implementations

4.2k373.5M3.1k](/packages/symfony-cache)[sentry/sentry

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

1.9k240.0M317](/packages/sentry-sentry)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[illuminate/log

The Illuminate Log package.

6225.0M606](/packages/illuminate-log)[api-platform/metadata

API Resource-oriented metadata attributes and factories

275.0M198](/packages/api-platform-metadata)[spiral/logger

LogFactory and global log listeners

148.5M16](/packages/spiral-logger)

PHPackages © 2026

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