PHPackages                             alexeevdv/yii2-psr-log-adapter - 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. alexeevdv/yii2-psr-log-adapter

ActiveYii2-extension[Logging &amp; Monitoring](/categories/logging)

alexeevdv/yii2-psr-log-adapter
==============================

1.0.1(7y ago)011.7k↓22.2%MITPHP

Since Jul 14Pushed 7y ago1 watchersCompare

[ Source](https://github.com/alexeevdv/yii2-psr-log-adapter)[ Packagist](https://packagist.org/packages/alexeevdv/yii2-psr-log-adapter)[ RSS](/packages/alexeevdv-yii2-psr-log-adapter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (3)Used By (0)

PSR3 log adapter for Yii2 logger
================================

[](#psr3-log-adapter-for-yii2-logger)

[![Build Status](https://camo.githubusercontent.com/ead0053b6497cb50598ea15c310589fba200e3d32829ff49d9a94b5556106171/68747470733a2f2f7472617669732d63692e6f72672f616c657865657664762f796969322d7073722d6c6f672d616461707465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/alexeevdv/yii2-psr-log-adapter)[![codecov](https://camo.githubusercontent.com/7bd5298efca9bfaf7ded23473992a748fae2977c28fc6ae94d4d9e525df7633f/68747470733a2f2f636f6465636f762e696f2f67682f616c657865657664762f796969322d7073722d6c6f672d616461707465722f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/alexeevdv/yii2-psr-log-adapter)[![PHP 5.6](https://camo.githubusercontent.com/02377f76b3cbe5c9bd3bc047522682376deaab69a4aed013b4a00018e068db72/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d352e362d677265656e2e737667)](https://camo.githubusercontent.com/02377f76b3cbe5c9bd3bc047522682376deaab69a4aed013b4a00018e068db72/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d352e362d677265656e2e737667)[![PHP 7.0](https://camo.githubusercontent.com/28174979e725b1f51a3ddc2a37022bd139e49d42f64fdc7b9322b3e5a15a3f7c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e302d677265656e2e737667)](https://camo.githubusercontent.com/28174979e725b1f51a3ddc2a37022bd139e49d42f64fdc7b9322b3e5a15a3f7c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e302d677265656e2e737667)[![PHP 7.1](https://camo.githubusercontent.com/89830e985e0a7f5f1ed58d412d81ee5bdccafb5dd5861eb9a6e63e44dde568b6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e312d677265656e2e737667)](https://camo.githubusercontent.com/89830e985e0a7f5f1ed58d412d81ee5bdccafb5dd5861eb9a6e63e44dde568b6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e312d677265656e2e737667)[![PHP 7.2](https://camo.githubusercontent.com/047bbe011ab372b4d00fc7ab0ed6f0d2a3db1ffda3a25de65f318dac100328ba/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e322d677265656e2e737667)](https://camo.githubusercontent.com/047bbe011ab372b4d00fc7ab0ed6f0d2a3db1ffda3a25de65f318dac100328ba/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e322d677265656e2e737667)[![PHP 7.3](https://camo.githubusercontent.com/ebdf47db6e91607cc8e1a8ea16f4a35122a068c1e3a23b9eb6c9932d602d28ff/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e332d677265656e2e737667)](https://camo.githubusercontent.com/ebdf47db6e91607cc8e1a8ea16f4a35122a068c1e3a23b9eb6c9932d602d28ff/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e332d677265656e2e737667)

Yii2 logger is not PSR3 compatible, therefore when you need logger functionality in third party library (which uses PSR3 logger interface), this package may save your time.

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

[](#installation)

The preferred way to install this extension is through [composer](https://getcomposer.org/download/).

Either run

```
$ php composer.phar require alexeevdv/yii2-psr-log-adapter
```

or add

```
"alexeevdv/yii2-psr-log-adapter": "^1.0"

```

to the `require` section of your `composer.json` file.

Usage
-----

[](#usage)

Lets assume some third party code

```
use Psr\Log\LoggerInterface;

class ThirdParty
{
    private $logger;

    function __construct(LoggerInterface $logger)
    {
        $this->logger = $logger;
    }
}
```

### Create adapter implicitly

[](#create-adapter-implicitly)

```
use alexeevdv\yii\PsrLoggerAdapter;

$logger = new PsrLoggerAdapter(['category' => 'my-category']);
$thirdParty = new ThirdParty($logger);
```

### Transparent usage via DI container

[](#transparent-usage-via-di-container)

```
// Yii application config
[
    //...
    'container' => [
        'definitions' => [
            \Psr\Log\LoggerInterface::class => [
                'class' => \alexeevdv\yii\PsrLoggerAdapter::class,
                'category' => 'my-category',
            ],
        ],
    ],
    //...
]

// Lest create third party object now
// Logger adapter will be injected automagically
$thirdParty = Yii::createObject(ThirdParty::class);
```

Configuration
-------------

[](#configuration)

By default yii logger is taken from DI container but you can specify your own if you wish.

```
use alexeevdv\yii\PsrLoggerAdapter;

$logger = new PsrLoggerAdapter([
    'logger' => 'mylogger', // logger configuration here. Anything that can be passed to \yii\di\Instance::ensure
    'category' => 'my-category',
]);
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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 ~248 days

Total

2

Last Release

2617d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e6f71682c6a273973ad9c29d60ddac6d3cc55db7e55ec4f5638115f4c22409f6?d=identicon)[alexeevdv](/maintainers/alexeevdv)

---

Top Contributors

[![alexeevdv](https://avatars.githubusercontent.com/u/597839?v=4)](https://github.com/alexeevdv "alexeevdv (8 commits)")

###  Code Quality

TestsCodeception

### Embed Badge

![Health badge](/badges/alexeevdv-yii2-psr-log-adapter/health.svg)

```
[![Health](https://phpackages.com/badges/alexeevdv-yii2-psr-log-adapter/health.svg)](https://phpackages.com/packages/alexeevdv-yii2-psr-log-adapter)
```

###  Alternatives

[sentry/sentry

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

1.9k227.1M273](/packages/sentry-sentry)[open-telemetry/api

API for OpenTelemetry PHP.

1933.0M214](/packages/open-telemetry-api)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2322.9M248](/packages/open-telemetry-sdk)[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)
