PHPackages                             yard/logger - 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. yard/logger

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

yard/logger
===========

Basic replaceable PSR-3 logger

v1.0.1(11mo ago)19.8k↓59.5%[1 issues](https://github.com/yardinternet/logger/issues)1MITPHPPHP &gt;=7.4CI passing

Since Apr 9Pushed 1w ago4 watchersCompare

[ Source](https://github.com/yardinternet/logger)[ Packagist](https://packagist.org/packages/yard/logger)[ RSS](/packages/yard-logger/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (2)Dependencies (5)Versions (6)Used By (1)

Replaceable PSR-3 Logger
========================

[](#replaceable-psr-3-logger)

[![Code Style](https://github.com/yardinternet/logger/actions/workflows/format-php.yml/badge.svg?no-cache)](https://github.com/yardinternet/logger/actions/workflows/format-php.yml)[![PHPStan](https://github.com/yardinternet/logger/actions/workflows/phpstan.yml/badge.svg?no-cache)](https://github.com/yardinternet/logger/actions/workflows/phpstan.yml)[![Tests](https://github.com/yardinternet/logger/actions/workflows/run-tests.yml/badge.svg?no-cache)](https://github.com/yardinternet/logger/actions/workflows/run-tests.yml)[![Code Coverage Badge](https://github.com/yardinternet/logger/raw/badges/coverage.svg)](https://github.com/yardinternet/logger/actions/workflows/badges.yml)[![Lines of Code Badge](https://github.com/yardinternet/logger/raw/badges/lines-of-code.svg)](https://github.com/yardinternet/logger/actions/workflows/badges.yml)

Composer package that provides a very basic PSR-3 logger. This logger is just a wrapper around PHP function `error_log()`. As such it does not have any requirements other than `psr/log`. It is meant to be used in PHP environments that might not feature a DI container, like WordPress.

The provided logger is actually meant as a temporary stub. The most prominent feature of this package is that the logger can be replaced by any another PSR-3 logger. This allows projects to push a single logger to its dependencies and achieve consistent log handling.

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

[](#installation)

To install this package using Composer, follow these steps:

1. Add the following to the `repositories` section of your `composer.json`:

    ```
    {
      "type": "vcs",
      "url": "git@github.com:yardinternet/logger.git"
    }
    ```
2. Install this package with Composer:

    ```
    composer require yard/logger
    ```

Usage
-----

[](#usage)

Simply use the static `Log` facade:

```
Log::error('Whoops.');
```

Or get the PSR-3 logger instance from it:

```
$logger = Log::getLogger();
```

Projects that wish to replace the logger instance can use the static `setLogger()` method, like this:

```
Log::setLogger(app()->make('log'));
```

### WordPress

[](#wordpress)

When using the logger in WordPress themes, the above replacement method is not recommended, due to the practise of vendor prefixing. The recommended method to replace the logger from a WordPress theme is to:

1. Use `do_action()` in WordPress themes to pass the desired logger to any plugins
2. Use `add_action()` in WordPress plugins to receive a logger instance and set it.

The `Log` class provides the `WP_ACTION_SET_LOGGER` constant, which contains the name of the WordPress action that should be used. Hooking into the action should look like:

```
add_action(Yard\Logging\Log::WP_ACTION_SET_LOGGER, Log::setLogger(...));
```

An [Acorn](https://roots.io/acorn/) based WordPress theme for example could push its Laravel logger like this:

```
do_action(Yard\Logging\Log::WP_ACTION_SET_LOGGER, app()->make('log'));
```

About us
--------

[](#about-us)

[![banner](https://raw.githubusercontent.com/yardinternet/.github/refs/heads/main/profile/assets/small-banner-github.svg)](https://www.yard.nl/werken-bij/)

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance57

Moderate activity, may be stable

Popularity27

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87% 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 ~103 days

Total

2

Last Release

347d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/62775?v=4)[Anton Zhuravsky](/maintainers/Yard)[@yard](https://github.com/yard)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (47 commits)")[![FreakyWizard](https://avatars.githubusercontent.com/u/114140418?v=4)](https://github.com/FreakyWizard "FreakyWizard (4 commits)")[![ictbeheer](https://avatars.githubusercontent.com/u/14947039?v=4)](https://github.com/ictbeheer "ictbeheer (2 commits)")[![dtakken](https://avatars.githubusercontent.com/u/2066447?v=4)](https://github.com/dtakken "dtakken (1 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/yard-logger/health.svg)

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

###  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.3M623](/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)
