// Log a value to the debug panel during development
Debug::addMessage('general', 'User ID', $userId);
Debug::addMessage('params', 'POST data', $_POST);
// Log an error that persists through a redirect (stored in session)
Debug::addMessage('errors', 'Mailer', $exception->getMessage(), 'session');
// Read it back after redirect
$error = Debug::getMessage('errors', 'Mailer');
// The debug panel is rendered automatically in footer.tpl.php:
// Debug::displayInfo(Url::url('/action'));
// → only outputs when DEBUG === true
Framework Docs
Debug
Debug
The
Debug
class powers the built-in debug panel. When
DEBUG
is true, it collects SQL queries, parameter values, warnings, and errors throughout the request lifecycle and renders them in a panel at the bottom of each page.
Namespace: Wojo\Core\Debug — all methods are static.
API
| Method | Signature | Description |
|---|---|---|
| run() | static run(): void |
Start the debug timer. Called by bootstrap. No-op when DEBUG is false. |
| addMessage() | static addMessage(string $type, string $key, mixed $val, string $storeType = ''): void |
Append a message to a debug channel. Pass storeType: 'session' to persist across redirects. |
| getMessage() | static getMessage(string $type, string $key): mixed |
Read back a stored debug message by type and key. |
| displayInfo() | static displayInfo(string $url = '/action'): void |
Render the debug panel HTML. Called at the end of the footer template. Do not use in production. |
Message Channels
The $type parameter in
addMessage()
routes to a named panel tab:
| Type | Description |
|---|---|
| general | Generic key/value info (app version, env settings, etc.) |
| params | Bound SQL parameters, input data snapshots |
| queries | Executed SQL statements (autopopulated by the Database class) |
| warnings | Non-fatal PHP warnings and notices |
| errors | PHP errors and caught exceptions |