-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Muhammet Şafak edited this page May 24, 2026
·
2 revisions
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/loggeruse 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
- New to the package? Read Installation, then Quick Start.
- Picking a handler? Compare FileLogger, PDOLogger and the Multi-Logger.
- Writing your own handler? See Custom Handlers.
- PSR-3 questions? Jump to PSR-3 Compliance and Context Interpolation.
- Looking for a specific method? The complete API Reference lists every class member.
| 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 | ❌ | ❌ | ✅ |
- License: MIT
- Minimum PHP: 8.0
-
PSR-3 contract:
psr/log^3.0 -
Packagist:
initphp/logger - Source: github.com/InitPHP/Logger
- Issues: github.com/InitPHP/Logger/issues
- Discussions: github.com/orgs/InitPHP/discussions
-
Security:
SECURITY.md
If something in this wiki is unclear, ambiguous, or wrong, please open an issue — documentation fixes are reviewed eagerly.
initphp/logger · MIT License · part of the InitPHP family
Source · Issues · Discussions · Packagist · Contributing · Security Policy
Getting Started
Handlers
PSR-3 Behaviour
Practical Guides
Reference