Coder Social home page Coder Social logo

phpdebugbar's Introduction

phpdebugbar middleware Build Status

PHP Debug bar PSR-15 middleware with PSR-7

This middleware provide framework-agnostic possibility to attach PHP Debug Bar to your response (html on non-html!).

Installation

composer require php-middleware/php-debug-bar

To build this middleware you need to injecting inside PhpDebugBarMiddleware instance DebugBar\JavascriptRenderer (you can get it from DebugBar\StandardDebugBar) and add middleware to your middleware runner. Or use default factory.

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

// OR

$factory = new PhpMiddleware\PhpDebugBar\PhpDebugBarMiddlewareFactory();
$middleware = $factory();

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

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

How to install on Zend Expressive?

Use mtymek/expressive-config-manager and add PhpMiddleware\PhpDebugBar\ConfigProvider class name:

$configManager = new \Zend\Expressive\ConfigManager\ConfigManager([
    \PhpMiddleware\PhpDebugBar\ConfigProvider::class,
    new \Zend\Expressive\ConfigManager\PhpFileProvider('config/autoload/{{,*.}global,{,*.}local}.php'),
]);

more about config manager.

How to install on Slim 3?

Add existing factory to container:

$container['debugbar_middleware'] = new PhpMiddleware\PhpDebugBar\PhpDebugBarMiddlewareFactory();

and add middleware from container to app:

$app->add($app->getContainer()->get('debugbar_middleware'));

How to configure using existing factories?

Put array with configuration into config 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
        ],
    ],
];

It's just works with any modern php framework!

Middleware tested on:

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

phpdebugbar's People

Contributors

snapshotpl avatar llaville avatar weierophinney avatar

Watchers

Sascha-Oliver Prolic avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.