filisko/fake-psr3-logger

Fake PSR-3 cache implementation for integration testing

v1.0.0 2025-04-22 21:28 UTC

This package is auto-updated.

Last update: 2025-04-22 21:29:23 UTC


README

Latest Version on Packagist Software License Testing Total Downloads

A simple package that provides a PSR-3 implementation for integration tests.

Requirements

  • PHP >= 7.2

Installation

This package is installable and autoloadable via Composer as filisko/fake-psr3-logger.

You probably want to add it as a dev dependency:

composer require filisko/fake-psr3-logger --dev

Usage

This package provides a PSR-3 (Psr\Log\LoggerInterface) implementation that allows you to verify the logging your code has made.

use Filisko\FakeLogger;

// PHP Unit scenario

$logger = new FakeLogger();
$logger->info('Something interesting happened', [
    'user_id' => 1
]);

// logs exposed
$logs = $logger->logs();

$this->assertSame([
    [
        'level' => 'info',
        'message' => 'Something interesting happened',
        'context' => [
            'user_id' => 1,
        ],
    ]
], $logs);

$this->assertSame(1, $logger->count());

Please see CHANGELOG for more information about recent changes and CONTRIBUTING for contributing details.

The MIT License (MIT). Please see LICENSE for more information.