PHPackages                             duncan3dc/logger-aware-trait - 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. duncan3dc/logger-aware-trait

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

duncan3dc/logger-aware-trait
============================

A PSR-3 trait allowing any class to easily add logger support

1.0.0(4y ago)134.2k↓36.8%42Apache-2.0PHPPHP ^7.3 || ^8.0

Since Feb 5Pushed 4y ago1 watchersCompare

[ Source](https://github.com/duncan3dc/logger-aware-trait)[ Packagist](https://packagist.org/packages/duncan3dc/logger-aware-trait)[ Docs](https://github.com/duncan3dc/logger-aware-trait)[ RSS](/packages/duncan3dc-logger-aware-trait/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (4)Used By (2)

logger-aware-trait
==================

[](#logger-aware-trait)

A PSR-3 trait allowing any class to easily add logger support

[![release](https://camo.githubusercontent.com/4efb7bf237c9f01ccbff0cff6ff731b380343b0b4848a8b1275843c5c4af866d/68747470733a2f2f706f7365722e707567782e6f72672f64756e63616e3364632f6c6f676765722d61776172652d74726169742f76657273696f6e2e737667)](https://packagist.org/packages/duncan3dc/logger-aware-trait)[![build](https://github.com/duncan3dc/logger-aware-trait/workflows/.github/workflows/buildcheck.yml/badge.svg?branch=main)](https://github.com/duncan3dc/logger-aware-trait/actions?query=branch%3Amain+workflow%3A.github%2Fworkflows%2Fbuildcheck.yml)[![coverage](https://camo.githubusercontent.com/c0f0dd37f2ab5e2bc26472e5e0c4abcb88821736a024fc0ade64b917a74ff0df/68747470733a2f2f636f6465636f762e696f2f67682f64756e63616e3364632f6c6f676765722d61776172652d74726169742f67726170682f62616467652e737667)](https://codecov.io/gh/duncan3dc/logger-aware-trait)

Installing
----------

[](#installing)

The recommended method of installing this library is via [Composer](//getcomposer.org/).

Run the following command from your project root:

```
$ composer require duncan3dc/logger-aware-trait
```

Setup
-----

[](#setup)

Simply apply the trait to your classes:

```
use duncan3dc\Log\LoggerAwareTrait;

class MyClass
{
    use LoggerAwareTrait;
}
```

Now the class will have a `getLogger()` method that you can safely call.
If a logger has been injected using `setLogger()` then that logger will be provided, otherwise a `NullLogger` will be used instead.

Changelog
---------

[](#changelog)

A [Changelog](CHANGELOG.md) has been available since the beginning of time

Where to get help
-----------------

[](#where-to-get-help)

Found a bug? Got a question? Just not sure how something works?
Please [create an issue](//github.com/duncan3dc/logger-aware-trait/issues) and I'll do my best to help out.
Alternatively you can catch me on [Twitter](https://twitter.com/duncan3dc)

duncan3dc/logger-aware-trait for enterprise
-------------------------------------------

[](#duncan3dclogger-aware-trait-for-enterprise)

Available as part of the Tidelift Subscription

The maintainers of duncan3dc/logger-aware-trait and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-duncan3dc-logger-aware-trait?utm_source=packagist-duncan3dc-logger-aware-trait&utm_medium=referral&utm_campaign=readme)

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 96.9% 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 ~946 days

Total

3

Last Release

1495d ago

Major Versions

0.2.0 → 1.0.02022-04-14

PHP version history (2 changes)0.1.0PHP ^7.0

1.0.0PHP ^7.3 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/11dc66042513f11d1c99b1e6763f25dca84a3ff31cdbea3972b9b804a3d3d5e9?d=identicon)[duncan3dc](/maintainers/duncan3dc)

---

Top Contributors

[![duncan3dc](https://avatars.githubusercontent.com/u/546811?v=4)](https://github.com/duncan3dc "duncan3dc (31 commits)")[![Shakarhaba](https://avatars.githubusercontent.com/u/1680143?v=4)](https://github.com/Shakarhaba "Shakarhaba (1 commits)")

---

Tags

psr-3loggingloggerPHPFIG

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/duncan3dc-logger-aware-trait/health.svg)

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

###  Alternatives

[analog/analog

Fast, flexible, easy PSR-3-compatible PHP logging package with dozens of handlers.

3451.5M24](/packages/analog-analog)[inpsyde/wonolog

Monolog-based logging package for WordPress.

183617.9k7](/packages/inpsyde-wonolog)[apix/log

Minimalist, thin and fast PSR-3 compliant (multi-bucket) logger.

511.0M18](/packages/apix-log)[markrogoyski/simplelog-php

Powerful PSR-3 logging. So easy, it's simple.

2818.1k4](/packages/markrogoyski-simplelog-php)

PHPackages © 2026

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