filisko / fake-psr3-logger
Fake PSR-3 cache implementation for integration testing
v1.0.0
2025-04-22 21:28 UTC
Requires
- php: ^7.2 || ^8.0
- psr/log: ^1 || ^2 || ^3
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3
- phpstan/phpstan: ^1 || ^2
- phpunit/phpunit: ^8 || ^9
- squizlabs/php_codesniffer: ^3
Provides
- psr/log-implementation: ^1 || ^2 || ^3
README
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.