PHPackages                             wyrihaximus/psr-3-utilities - 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. wyrihaximus/psr-3-utilities

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

wyrihaximus/psr-3-utilities
===========================

PSR-3 logger utilities

2.4.0(1mo ago)2277.7k↑1066.1%1[1 issues](https://github.com/WyriHaximus/php-psr-3-utilities/issues)[2 PRs](https://github.com/WyriHaximus/php-psr-3-utilities/pulls)8MITMakefilePHP ^8.4CI passing

Since Jun 25Pushed 1w ago1 watchersCompare

[ Source](https://github.com/WyriHaximus/php-psr-3-utilities)[ Packagist](https://packagist.org/packages/wyrihaximus/psr-3-utilities)[ GitHub Sponsors](https://github.com/WyriHaximus)[ RSS](/packages/wyrihaximus-psr-3-utilities/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (7)Dependencies (6)Versions (16)Used By (8)

Utility functions for [PSR-3](http://www.php-fig.org/psr/psr-3/)
================================================================

[](#utility-functions-for-psr-3)

[![Linux Build Status](https://camo.githubusercontent.com/f9e9b78237ceccd1dd80fca0c188bed8c2fda10f0a154f8b51a00fd18f09a2dd/68747470733a2f2f7472617669732d63692e6f72672f57797269486178696d75732f7068702d7073722d332d7574696c69746965732e706e67)](https://travis-ci.org/WyriHaximus/php-psr-3-utilities)[![Latest Stable Version](https://camo.githubusercontent.com/b0773be3219d704674c0c91b0531cfe2f195d0a5cad2e0360fa6ab7e942961d2/68747470733a2f2f706f7365722e707567782e6f72672f57797269486178696d75732f7073722d332d7574696c69746965732f762f737461626c652e706e67)](https://packagist.org/packages/WyriHaximus/psr-3-utilities)[![Total Downloads](https://camo.githubusercontent.com/a9ca012032eb74a6e5b7378040d7a18887e3d8a0b279799930907d624cdc928b/68747470733a2f2f706f7365722e707567782e6f72672f57797269486178696d75732f7073722d332d7574696c69746965732f646f776e6c6f6164732e706e67)](https://packagist.org/packages/WyriHaximus/psr-3-utilities/stats)[![Code Coverage](https://camo.githubusercontent.com/bcffa360a3bbccae9720bf6f5fb9d95000d8688dc468bb3bb10542c81bf283e2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f57797269486178696d75732f7068702d7073722d332d7574696c69746965732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/WyriHaximus/php-psr-3-utilities/?branch=master)[![License](https://camo.githubusercontent.com/b51b6530dce2885a385b36e6fa854252e97da400e3c3397ce15c084db5d2de0f/68747470733a2f2f706f7365722e707567782e6f72672f57797269486178696d75732f7073722d332d7574696c69746965732f6c6963656e73652e706e67)](https://packagist.org/packages/wyrihaximus/psr-3-utilities)

### Installation

[](#installation)

To install via [Composer](http://getcomposer.org/), use the command below, it will automatically detect the latest version and bind it with `^`.

```
composer require wyrihaximus/psr-3-utilities

```

Functions
---------

[](#functions)

- `Utils::processPlaceHolders` - Handle placeholders as specified in [PSR-3](http://www.php-fig.org/psr/psr-3/).
- `Utils::formatValue` - Format any given value as a string.
- `Utils::normalizeContext` - Normalize the context ensure resources are represented as strings.
- `Utils::checkCorrectLogLevel` - Throw an `Psr\Log\InvalidArgumentException` when the passed log level isn't defined on `Psr\Log\LogLevel`.

Test ProcessPlaceHoldersLogger
------------------------------

[](#test-processplaceholderslogger)

To help write strict unit tests with [`colinodell/psr-testlogger`](https://github.com/colinodell/psr-testlogger). Consider the following real life example of need to match very specific `type` values in the logs:

```
$filesystem = Factory::create();

$logger   = new TestLogger();
$producer = Mockery::mock(Producer::class);
$producer->shouldReceive('send')->withArgs(static function (File $file): bool {
    if ($file->type !== 'space' && $file->type !== 'hallow-azeroth') {
        return false;
    }

    return $file->file === $file->type . '.jpg';
});

new RootFiles(
    new ProcessPlaceHoldersLogger($logger),
    $filesystem->directory(__DIR__ . '/data/maptiles/'),
    $producer,
    new Registry(Configuration::create()),
)->perform();

self::assertTrue($logger->hasDebugThatContains('Scanning types'));
self::assertTrue($logger->hasDebugThatContains('Scanning for root files in space'));
self::assertTrue($logger->hasInfoThatContains('Found for upload: space.jpg'));
self::assertTrue($logger->hasDebugThatContains('Scanning for root files in hallow-azeroth'));
self::assertTrue($logger->hasInfoThatContains('Found for upload: hallow-azeroth.jpg'));
self::assertTrue($logger->hasDebugThatContains('Done scanning types'));
```

Origins
-------

[](#origins)

The origins of this packages came from the need of complying to [PSR-3](http://www.php-fig.org/psr/psr-3/) place holders. (Like 'message {key}'.) And I came out at [`Monolog`](https://github.com/Seldaek/monolog/blob/6e6586257d9fb231bf039563632e626cdef594e5/src/Monolog/Processor/PsrLogMessageProcessor.php), initially the code was used on ['wyrihaximus/react-psr-3-loggly`](https://github.com/WyriHaximus/reactphp-psr-3-loggly) but extracted it into it's own package now that I needed it in more package.

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

[](#contributing)

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

License
-------

[](#license)

Copyright 2025 [Cees-Jan Kiewiet](http://wyrihaximus.net/)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

63

—

FairBetter than 99% of packages

Maintenance86

Actively maintained with recent releases

Popularity39

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity88

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 65.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 ~465 days

Recently: every ~400 days

Total

8

Last Release

40d ago

Major Versions

1.1.1 → 2.0.02022-01-06

PHP version history (5 changes)1.0.0PHP ^7.0

1.1.0PHP ^7.2

2.0.0PHP ^8

2.2.0PHP ^8.3

2.3.0PHP ^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/147145?v=4)[Cees-Jan Kiewiet](/maintainers/WyriHaximus)[@WyriHaximus](https://github.com/WyriHaximus)

---

Top Contributors

[![WyriHaximus](https://avatars.githubusercontent.com/u/147145?v=4)](https://github.com/WyriHaximus "WyriHaximus (67 commits)")[![dependabot-support](https://avatars.githubusercontent.com/u/112581971?v=4)](https://github.com/dependabot-support "dependabot-support (12 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (10 commits)")[![renovate-runner[bot]](https://avatars.githubusercontent.com/u/147145?v=4)](https://github.com/renovate-runner[bot] "renovate-runner[bot] (7 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (6 commits)")

---

Tags

hacktoberfestphpphp7php8psr-3utilities

### Embed Badge

![Health badge](/badges/wyrihaximus-psr-3-utilities/health.svg)

```
[![Health](https://phpackages.com/badges/wyrihaximus-psr-3-utilities/health.svg)](https://phpackages.com/packages/wyrihaximus-psr-3-utilities)
```

###  Alternatives

[sentry/sentry

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

1.9k247.1M335](/packages/sentry-sentry)[symfony/cache

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

4.2k373.5M3.3k](/packages/symfony-cache)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[illuminate/log

The Illuminate Log package.

6225.3M626](/packages/illuminate-log)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[api-platform/metadata

API Resource-oriented metadata attributes and factories

275.0M219](/packages/api-platform-metadata)

PHPackages © 2026

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