middlewares / debugbar
Middleware to insert PHP DebugBar automatically in html responses
Installs: 8 765
Dependents: 7
Suggesters: 0
Security: 0
Stars: 12
Watchers: 2
Forks: 4
Open Issues: 1
Requires
- php: ^7.2 || ^8.0
- maximebf/debugbar: ^1.13
- middlewares/utils: ^3.0
- psr/http-server-middleware: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.0
- laminas/laminas-diactoros: ^2.3
- oscarotero/php-cs-fixer-config: ^1.0
- phpstan/phpstan: ^0.12
- phpunit/phpunit: ^8|^9
- squizlabs/php_codesniffer: ^3.0
README
Middleware to insert PHP DebugBar automatically in html responses.
Requirements
- PHP >= 7.2
- A PSR-7 http library
- A PSR-15 middleware dispatcher
Installation
This package is installable and autoloadable via Composer as middlewares/debugbar.
composer require middlewares/debugbar
Example
$dispatcher = new Dispatcher([ new Middlewares\Debugbar() ]); $response = $dispatcher->dispatch(new ServerRequest());
Usage
You can provide a DebugBar\DebugBar
instance to the constructor or an instance of DebugBar\StandardDebugBar
will be created automatically. Optionally, you can provide a Psr\Http\Message\ResponseFactoryInterface
and Psr\Http\Message\StreamFactoryInterface
to create the new responses. If it's not defined, Middleware\Utils\Factory will be used to detect it automatically.
//Create a StandardDebugBar automatically $debugbar = new Middlewares\Debugbar(); //Use other Debugbar instance $debugbar = new Middlewares\Debugbar($myDebugbar); //Use other Debugbar instance and PSR-17 factories $debugbar = new Middlewares\Debugbar($myDebugbar, $myResponseFactory, $myStreamFactory);
captureAjax
Use this option to capture ajax requests and send the data in the headers. More info about AJAX and Stacked data. By default it's disabled.
$debugbar = (new Middlewares\Debugbar())->captureAjax();
inline
Set true to dump the js/css code inline in the html. This fixes (or mitigate) some issues related with loading the debugbar assets.
$debugbar = (new Middlewares\Debugbar())->inline();
Please see CHANGELOG for more information about recent changes and CONTRIBUTING for contributing details.
The MIT License (MIT). Please see LICENSE for more information.