PHPackages                             vstelmakh/psr-test-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. [Testing &amp; Quality](/categories/testing)
4. /
5. vstelmakh/psr-test-logger

ActiveLibrary[Testing &amp; Quality](/categories/testing)

vstelmakh/psr-test-logger
=========================

Easy to use PSR-3 compliant test-logger

v1.0.1(1y ago)482201MITPHPPHP ^8.1CI passing

Since Feb 23Pushed 2mo ago1 watchersCompare

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

READMEChangelog (2)Dependencies (4)Versions (4)Used By (1)

  ![PSR Test Logger logo](resources/psr-test-logger-logo-black.svg)---

[![build](https://github.com/vstelmakh/psr-test-logger/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/vstelmakh/psr-test-logger/actions/workflows/build.yml)[![Packagist version](https://camo.githubusercontent.com/af3428a74cb29e0af0ca816d81c76cee1eef832f9aa7a8960a46804e8bc3014e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f767374656c6d616b682f7073722d746573742d6c6f676765723f636f6c6f723d6f72616e6765)](https://packagist.org/packages/vstelmakh/psr-test-logger)

PSR Test Logger
===============

[](#psr-test-logger)

PSR Test Logger is a simple and easy-to-use [PSR-3](https://www.php-fig.org/psr/psr-3/) compliant logger designed specifically for testing. It provides seamless integration with [PHPUnit](https://phpunit.de/), making logging assertions effortless. With PSR Test Logger, you can efficiently verify log messages and context, ensuring your application logs expected events without unnecessary complexity.

Key features:

- **Fluent Interface** - Provides clean test assertions with intuitive IDE autocompletion.
- **Predefined Assertions** - A rich set of built-in assertions to validate log messages and contexts.
- **Automatic PHPUnit Integration** - Works seamlessly within PHPUnit test cases, with zero configuration.
- **Extensible** - Easily customizable to fit your testing needs.

If you wonder why not to just mock the logger interface in your tests. The main 🏆 advantage of PSR Test Logger in comparison to mocking logger - is simplicity of development and maintenance. For more details and examples see the [Advantages of PSR Test Logger over Mock](./docs/advantages-over-mock.md).

Requirements
------------

[](#requirements)

RequirementVersionPHP&gt;= 8.1psr/log&gt;= 2.0Note

PHPUnit is not required to use PSR Test Logger. It can be used completely standalone.

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

[](#installation)

Install the latest version with [Composer](https://getcomposer.org/):

```
composer require --dev vstelmakh/psr-test-logger
```

Remember to require as `dev` dependency. Most likely, you don't need this in production.

Usage Example
-------------

[](#usage-example)

```
