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:

ClassPurpose
FileLoggerAppends each record as a single line to a file.
PDOLoggerInserts each record as a row in a relational table.
LoggerFan-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
useInitPHP\Logger\FileLogger;
$logger = newFileLogger(['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

CapabilityFileLoggerPDOLoggerLogger
PSR-3 v3 compliant
Accepts string|\Stringable messages
Renders \Throwable context values(delegates)
Concurrent-safe writes✅ (LOCK_EX)✅ (DB-level)(delegates)
Auto-creates parent directoryn/an/a
Validates configuration eagerly
Path / table tokenisation{year}/{month}/…identifier regexn/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