colinodell/psr-testlogger
A lightweight PSR-3 TestLogger for unit tests. Capture log records in memory, inspect messages, contexts, and levels, and make assertions without external handlers. Helpful for verifying expected logging behavior in PHPUnit and other test suites.
Architecture fit is strong due to PSR-3 compliance, allowing seamless replacement of Laravel's default Monolog logger in test environments without code changes to application logic. Integration feasibility is high—Laravel's service container can bind this logger during test setup via bind(LoggerInterface::class, TestLogger::class). Technical risk is low for typical unit tests but non-zero: the package's low GitHub stars (17) and suspicious future release date (2025-11-04) raise maintenance concerns. Key questions include: How does it handle log retention across parallel test runs? Does it properly reset between test cases automatically? Are there known issues with Laravel-specific context data (e.g., user IDs, request IDs) in logs?
Stack fit is excellent—Laravel's test environment already uses PSR-3, making this a drop-in solution for Log::debug() and similar calls. Migration path requires minimal changes: replace the logger instance in test setup (e.g., via setUp() in PHPUnit or a custom TestCase class) and refactor existing log-assertion logic to use the test logger's built-in methods (e.g., assertLoggedWith()). Compatibility is guaranteed for all PSR-3-compliant code, but Laravel-specific features like log channels or context processors would need validation. Sequencing should prioritize binding the test
How can I help you explore Laravel packages today?