All Projects → php-middleware → phpdebugbar

php-middleware / phpdebugbar

Licence: MIT License
PSR-15 middleware for PHP Debug bar

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to phpdebugbar

Grpc Tools
A suite of gRPC debugging tools. Like Fiddler/Charles but for gRPC.
Stars: ✭ 881 (+1276.56%)
Mutual labels:  middleware, debugging-tool
express-view-cache
Unobtrusive solution to express framework - cache rendered page, without database requests and rendering.
Stars: ✭ 20 (-68.75%)
Mutual labels:  middleware
express-xml-bodyparser
Simple XML body parser connect/express middleware
Stars: ✭ 64 (+0%)
Mutual labels:  middleware
jquery-manager
Manage jQuery and jQuery Migrate on a WordPress website, activate a specific jQuery and/or jQuery Migrate version. The ultimate jQuery debugging tool for WordPress
Stars: ✭ 27 (-57.81%)
Mutual labels:  debugging-tool
ripdb
Remotely accessible IPython-enabled debugger
Stars: ✭ 21 (-67.19%)
Mutual labels:  debugging-tool
rmw ecal
ROS2 middleware based on eCAL
Stars: ✭ 30 (-53.12%)
Mutual labels:  middleware
whoops-middleware
PSR-15 compatible middleware for Whoops, the pretty error handler
Stars: ✭ 24 (-62.5%)
Mutual labels:  middleware
koii
A simple middleware for displaying routes in an express application
Stars: ✭ 73 (+14.06%)
Mutual labels:  middleware
fuxedo
An Open Source alternative to Oracle Tuxedo
Stars: ✭ 15 (-76.56%)
Mutual labels:  middleware
mooseware
💀 Skeleton for writing a middleware handler
Stars: ✭ 47 (-26.56%)
Mutual labels:  middleware
caddy-trace
Request Debugging Middleware Plugin for Caddy v2
Stars: ✭ 25 (-60.94%)
Mutual labels:  debugging-tool
jwt-auth
JSON Web Token Authentication for Laravel and Lumen
Stars: ✭ 46 (-28.12%)
Mutual labels:  middleware
server-timing
Collect backend metrics and provide them as Server-Timing header in your responses
Stars: ✭ 34 (-46.87%)
Mutual labels:  middleware
express-firebase-middleware
🔥 Express middleware for your Firebase applications
Stars: ✭ 53 (-17.19%)
Mutual labels:  middleware
Guardian
Service Side Swift:Vapor 3 based API Guardian Middleware. 🦁
Stars: ✭ 90 (+40.63%)
Mutual labels:  middleware
express-ping
Let all your express applications expose a common API to inform about their internal status and health.
Stars: ✭ 50 (-21.87%)
Mutual labels:  middleware
guide-charles-proxy
Charles - Web Debugging Proxy Application. I want to share my experiences when I worked with Charles. It is such an amazing application for debugging and testing the presentation of UI when trying different set of data. Hope you guys will master Charles after reading this section. Let’s find out! 🖍
Stars: ✭ 22 (-65.62%)
Mutual labels:  debugging-tool
rbac
RBAC - Simple, concurrent Role Based Access Control(GO)
Stars: ✭ 67 (+4.69%)
Mutual labels:  middleware
deepword
Web editor based on Monaco
Stars: ✭ 25 (-60.94%)
Mutual labels:  middleware
dog
Full repository for the Dog gateway
Stars: ✭ 21 (-67.19%)
Mutual labels:  middleware

phpdebugbar middleware Build Status

PHP Debug Bar as framework-agnostic PSR-15 middleware with PSR-7 messages created by PSR-17 message factories. Also provides PSR-11 container invokable factories.

Framework-agnostic way to attach PHP Debug Bar to your response (html or non-html!).

Installation

composer require --dev php-middleware/php-debug-bar

To build middleware you need to inject DebugBar\JavascriptRenderer (you can get it from DebugBar\StandardDebugBar) inside PhpDebugBarMiddleware and add it into your middleware runner:

$debugbar = new DebugBar\StandardDebugBar();
$debugbarRenderer = $debugbar->getJavascriptRenderer('/phpdebugbar');
$middleware = new PhpMiddleware\PhpDebugBar\PhpDebugBarMiddleware($debugbarRenderer, $psr17ResponseFactory, $psr17StreamFactory);

// or use provided factory
$factory = new PhpMiddleware\PhpDebugBar\PhpDebugBarMiddlewareFactory();
$middleware = $factory($psr11Container);

$app = new MiddlewareRunner();
$app->add($middleware);
$app->run($request, $response);

You don't need to copy any static assets from phpdebugbar vendor!

How to force disable or enable PHP Debug Bar?

Sometimes you want to have control when enable or disable PHP Debug Bar:

  • custom content negotiation,
  • allow debug redirects responses.

We allow you to disable attaching phpdebugbar using X-Enable-Debug-Bar: false header, cookie or request attribute. To force enable just send request with X-Enable-Debug-Bar header, cookie or request attribute with true value.

PSR-17

This package isn't require any PSR-7 implementation - you need to provide it by own. Middleware require ResponseFactory and StreamFactory interfaces. List of existing interfaces.

... and PSR-11

If you use provided PSR-11 factories, then your container must have services registered as PSR-17 interface's name. Example for laminas-diactoros implementation and Pimple:

$container[Psr\Http\Message\ResponseInterface::class] = new Laminas\Diactoros\ResponseFactory();
$container[Psr\Http\Message\StreamFactoryInterface::class] = new Laminas\Diactoros\StreamFactory();

How to install on Mezzio?

You need to register PhpMiddleware\PhpDebugBar\ConfigProvider and pipe provided middleware:

$app->pipe(\PhpMiddleware\PhpDebugBar\PhpDebugBarMiddleware::class);

For more - follow Mezzio documentation.

How to install on Slim 3?

Register factories in container:

foreach (ConfigProvider::getConfig()['dependencies']['factories'] as $key => $factory) {
    $container[$key] = new $factory();
}

and add middleware from container to app:

$app->add(
    $app->getContainer()->get(\PhpMiddleware\PhpDebugBar\PhpDebugBarMiddleware::class)
);

How to configure using existing factories?

Put array with a configuration into PhpMiddleware\PhpDebugBar\ConfigProvider service in your container:

return [
    'phpmiddleware' => [
        'phpdebugbar' => [
            'javascript_renderer' => [
                'base_url' => '/phpdebugbar',
            ],
            'collectors' => [
                DebugBar\DataCollector\ConfigCollector::class, // Service names of collectors
            ],
            'storage' => null, // Service name of storage
        ],
    ],
];

You can override existing configuration by merge default configuration with your own (example):

return array_merge(PhpMiddleware\PhpDebugBar\ConfigProvider::getConfig(), $myOverritenConfig);

It's just works with any modern php framework!

Middleware tested on:

And any other modern framework supported PSR-17 middlewares and PSR-7.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].