Skip to content
Muhammet Şafak edited this page May 24, 2026 · 2 revisions

InitPHP Logger — Wiki

Welcome to the official documentation for initphp/logger — a small, focused, PSR-3 v3 compliant logger for PHP 8.0+.

The package ships three classes:

Class Purpose
FileLogger Appends each record as a single line to a file.
PDOLogger Inserts each record as a row in a relational table.
Logger Fan-out multiplexer: forwards every PSR-3 call to several handlers at once.

Every class implements Psr\Log\LoggerInterface, so you can drop the package into any framework or library that consumes that contract, or compose it with handlers from other PSR-3 packages.

composer require initphp/logger
use InitPHP\Logger\FileLogger;

$logger = new FileLogger(['path' => __DIR__ . '/logs/app.log']);
$logger->info('Service booted in {ms}ms', ['ms' => 42]);
2026-05-24T14:08:22+03:00 [INFO] Service booted in 42ms

Start here

Navigation

Getting Started

Handlers

PSR-3 Behaviour

Practical Guides

Reference

At a glance — feature matrix

Capability FileLogger PDOLogger Logger
PSR-3 v3 compliant
Accepts string|\Stringable messages
Renders \Throwable context values (delegates)
Concurrent-safe writes ✅ (LOCK_EX) ✅ (DB-level) (delegates)
Auto-creates parent directory n/a n/a
Validates configuration eagerly
Path / table tokenisation {year}/{month}/… identifier regex n/a
Fan-out to multiple targets

Package metadata

If something in this wiki is unclear, ambiguous, or wrong, please open an issue — documentation fixes are reviewed eagerly.

Clone this wiki locally