Search by

webware / webware-log

tyrsson

Webware Logging component

Package info

github.com/webinertia/webware-log

Homepage

Chat

pkg:composer/webware/webware-log

Statistics

Installs: 6 438

Dependents: 3

Suggesters: 0

Stars: 2

Open Issues: 5

2.0.0-beta.3 2026-11-22 09:29 UTC

README

PHP Version Latest Stable Version License Continuous Integration codecov Mutation testing badge

This package provides logging via Monolog for Mezzio (PSR-15) applications. It provides a file handler for the application's data directory and a log handler backed by php-db/phpdb for writing logs to a database table. Neither is registered by default. It also provides a PSR-14 event listener for error logging.

Documentation

The 2.0 release line is documented under docs/2.0:

Quick Start

Install the package and let laminas-component-installer inject the ConfigProvider:

composer require webware/webware-log

Import the database schema and add the package's ConfigProvider to your config aggregator if not done automatically. The package registers no handler by default, so a logger it builds discards records until one is wired. To write to data/log/{channel}.log, register StreamHandlerFactory; to persist records to a table, install php-db/phpdb and register PhpDbHandler. Both are described in Handlers. Then pipe the middleware into your application pipeline:

// config/pipeline.php
$app->pipe(\Webware\Log\Http\Middleware\MonologMiddleware::class);

Enable optional features via config:

// config/autoload/log.local.php
use Psr\Log\LoggerInterface;

return [
    LoggerInterface::class => [
        'log_errors'     => true,  // auto-log uncaught exceptions
        'process_uuid'   => true,  // add UUID v7 to every record
        'channel'        => 'app', // LogChannel enum value
    ],
];

See the full documentation for details on all options, handlers, processors, and event-driven logging.