Developer toolbar for the Miniframe PHP Framework

v1.1.0 2022-07-20 19:34 UTC

This package is auto-updated.

Last update: 2022-11-25 19:45:52 UTC


This library adds a basic developer toolbar to the Miniframe PHP Framework.

build code coverage

How to install

  1. In your existing project, type: composer require --dev miniframe/developer-toolbar
  2. Add the directive below to a /config/development.ini
  3. Add the development.ini to your .gitignore (you won't want to have this running on production!)

Example development.ini directives

middleware[] = Miniframe\Toolbar\Middleware\DeveloperToolbar

log_path = cache/debug

Add the Middleware as high as possible in the Middleware list, so it's loaded before other middlewares get the chance of throwing errors.

How to use

On each HTML page, a bug icon is added. If you click on it, a new tab will open with debugging information.
When debugging non-HTML pages, look at the headers (Most browsers: F12 -> Network tab) and locate the X-Debug-URL header. If you open that URL, you will also get the debugging page.

In code, you can add var dumps to the debugging page by using:

dump(['foo', 'bar']);

It's also possible to add custom errors to the debugging page by using:

// notice:
trigger_error('foo bar');

// warning:
trigger_error('foo bar', E_USER_WARNING);

// or a deprecation notice:
trigger_error("Since Core v1.0.0: Test deprecation", E_USER_DEPRECATED);

For Windows Developers

In the bin folder, a few batch files exist, to make development easier.

If you install Docker Desktop for Windows, you can use bin\composer.bat, bin\phpcs.bat, bin\phpunit.bat, bin\phpstan.bat and bin\security-checker.bat as shortcuts for Composer, CodeSniffer, PHPUnit, PHPStan and the Security Checker, without the need of installing PHP and other dependencies on your machine.

The same Docker container and tools are used in Bitbucket Pipelines to automatically test this project.