Global error handler
QuietGuard\Monitor\ErrorHandler registers PHP's global handlers so a plain-PHP host with no framework exception pipeline still reports uncaught errors. Frameworks (Laravel, Symfony) have their own hooks and should not call this.
Registering
ErrorHandler::register() is a single static call that takes a configured Reporter:
Call it once, as early as possible in your bootstrap, after the Reporter is built.
What it registers
register() wires three global hooks:
set_exception_handler, any uncaughtThrowableis sent via$reporter->reportException($e). The handler chains: if another global exception handler was registered beforeErrorHandler::register(), it still runs after the exception has been reported (the monitor reports first, then delegates). When no previous handler exists, the exception (message, file:line and stack trace) is written toerror_log, matching what PHP's default behavior would have recorded: installing monitoring never removes the host's local crash record.set_error_handler, a raised PHP error is wrapped in anErrorExceptionand reported. It first checkserror_reporting() & $severity, so values suppressed with@or below the currenterror_reportinglevel are skipped. It then returnsfalseso PHP's normal error handling still runs.register_shutdown_function, on shutdown,error_get_last()is inspected and, if it is a fatal type (E_ERROR,E_PARSE,E_CORE_ERROR,E_COMPILE_ERROR), anErrorExceptionis reported. This catches fatals that the error handler cannot.
Every path runs through the Reporter, which never throws, so registering these handlers cannot break the host.
A minimal plain-PHP bootstrap
The Laravel SDK, the Symfony bundle and the WordPress plugin do not useErrorHandler: Laravel and Symfony hook their own exception pipelines, and the WordPress plugin integrates with WordPress. Reach forErrorHandleronly in a host that has no exception pipeline of its own.
You are reading the PHP Core v1.0 documentation.