Download the PHP package xakki/phperrorcatcher without Composer
On this page you can find all versions of the php package xakki/phperrorcatcher. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download xakki/phperrorcatcher
More information about xakki/phperrorcatcher
Files in xakki/phperrorcatcher
Package phperrorcatcher
Short Description PHP Logger - Monolog/PSR compatible
License GPL-3.0-or-later
Homepage https://xakki.github.io/phperrorcatcher/
Informations about the package phperrorcatcher
PHPErrorCatcher
Logger for all PHP & JS errors (PSR-3), with pluggable storage backends.
Requires PHP 8.3+. Full runnable example:
example/test.php.
Install
Init
Instantiate with named arguments. The constructor registers all
error/exception/shutdown handlers and sets static::$obj (accessible as a
singleton via PhpErrorCatcher::init() for legacy code):
Deprecated:
PhpErrorCatcher::init(array $config)still works for backward compatibility but will be removed in a future release. Prefernew PhpErrorCatcher(...)with named arguments.
From here every uncaught error, exception and trigger_error() is captured
automatically.
Custom reporting
The instance implements Psr\Log\LoggerInterface, so log manually with the
standard PSR-3 methods. An exception can be passed straight as the message:
Browser (JS) errors
JsLogPlugin catches browser errors (window.onerror, console.error,
unhandledrejection, failed resource loads) and reports them to the PHP side.
It skips bots/crawlers and noise (cross-origin "Script error.", browser
extensions), de-duplicates, and attaches context (viewport, build version,
anonymized breadcrumbs).
There are two ways to include the script.
Static — serve the bundled file as-is. The trigger key must match the client
default catcherLogName, so set initGetKey => 'catcherLogName':
Dynamic (recommended) — let JsLogPlugin serve the script with the trigger
key (and an optional signed token) injected, so any initGetKey works. The
response is cached for one day:
An optional secret in the plugin config enables a stateless HMAC token: the
served script embeds a short-lived token that the server verifies on every log
(no storage needed). Leave it empty to gate access by initGetKey only.
Web log viewer
When errors are persisted with FileStorage, FileViewer renders an HTML
report to browse, download, back up and delete the stored log files. Register
it via the viewer config and gate access with its own initGetKey:
Then open the entry point with that key as a query parameter, e.g.
/?changeMe5=.
Related projects
- FluentLog (
xakki/fluent-log) — drop-in fluent-bit config that ships Docker container logs and on-disk log files to Graylog over GELF, and exposes fluent-bit metrics to Prometheus. - LaraLog (
xakki/laralog) — structured production logging for Laravel: a drop-inLogManagerwith custom drivers, formatters and Monolog processors that enrich and safeguard every log record.
All versions of phperrorcatcher with dependencies
ext-mbstring Version *
ext-json Version *
ext-curl Version *
ext-pdo Version *
psr/log Version ^3.0
ext-sockets Version *
ext-ctype Version *