maatify/logger is a PSR-3 compatible logger for PHP: a Monolog-backed Logger, a static LoggerService facade, a legacy RecordLog entry point, redaction of secrets before anything is written, and a JSON file fallback used only when Monolog is not loadable.
Published release: 7.0.0 (2026-10-31), distributed through Packagist.
- PSR-3 logger:
Maatify\Logger\LoggerimplementsPsr\Log\LoggerInterface. - Facade and legacy entry points: static
LoggerServicemethods andLogger::RecordLog()for existing code. - Secrets are redacted before they are written: sensitive context keys,
key=valuesecrets,Authorization: Bearer/Basicvalues andThrowablemessages and traces are masked. The list and a custom hook are configurable. - Request path only: the file fallback records
REQUEST_URIwithout its query string or fragment; the full URI is an explicit opt-in. - Time-partitioned files:
logs/YYYY/MM/DD/HH/with a404index.phpguard in each created folder. - Never throws on I/O failure in the fallback: write problems go to an internal error file instead.
composer.json is the source of truth for requirements and dependencies; this table reflects it.
| Requirement | Constraint |
|---|---|
| PHP | >=8.4.27 <8.5.0 || >=8.5.12 <8.6.0 |
| Extensions | ext-json |
monolog/monolog |
^3.9 |
psr/log |
^3.0 |
Install the published release:
composer require maatify/logger:7.0.0The command resolves through Packagist.
use Maatify\Logger\LoggerService;
LoggerService::info('User login successful', 'auth/logs');
try {
throw new RuntimeException('DB connection failed');
} catch (Throwable $e) {
LoggerService::logException($e, 'system/errors', context: ['requestId' => 'abc123']);
}Complete, runnable examples: examples/. Walkthroughs: docs/guides/USAGE_GUIDE.md.
An overview only. The complete inventory (signatures, behavior, errors) is LOGGER_PACKAGE_REFERENCE.md.
| Area | Types |
|---|---|
| PSR-3 logger | Logger (emergency() … debug(), log()) |
| Facade | LoggerService (static log(), level methods, logException()) |
| Legacy | Logger::RecordLog(), Logger::LEVEL_* constants |
| Redaction | Logger::setSensitiveKeys(), Logger::setRedactor(), Logger::redactContext() |
| Request URI policy | Logger::sanitizeRequestUri(), Logger::logFullRequestUri() |
- Monolog is the active backend: because
monolog/monologis a required dependency, entries go tologs/YYYY/MM/DD/HH/app_YYYY-MM-DD-HH.log. The per-call log file name only routes files in the file fallback; with Monolog it is carried in the context. - Redaction runs first on every call, in both backends, and never throws.
- Invalid level: a non-string or unknown level throws
Psr\Log\InvalidArgumentException.
The package masks well-known secret shapes; it cannot know every application secret. Add your own keys with Logger::setSensitiveKeys() or a hook with Logger::setRedactor(). Store logs outside the web root or deny access to them in your server configuration: the index.php guard in each log folder does not stop a web server from serving a known .log path. REMOTE_ADDR and USER_AGENT are written by the file fallback unconditionally; apply your own retention policy to log files. See SECURITY.md for reporting.
Maintained, smoke-executed examples using only the Public Runtime API: examples/.
PHPStan level max with no baseline, a PHPUnit suite, a Consumer Verification Harness (clean consumer install, production autoload) and smoke-executed examples run in CI; the CI gate job aggregates them.
composer ciEach gate and its CI mapping are listed in CONTRIBUTING.md.
Proprietary. See LICENSE.
Engineered by Mohamed Abdulalim (@megyptm)
Backend Lead & Technical Architect
https://www.maatify.dev