{"id":13395599,"url":"https://github.com/php-middleware/phpdebugbar","last_synced_at":"2025-12-28T09:09:22.967Z","repository":{"id":1212062,"uuid":"41689868","full_name":"php-middleware/phpdebugbar","owner":"php-middleware","description":"PSR-15 middleware for PHP Debug bar","archived":false,"fork":false,"pushed_at":"2023-08-07T15:53:21.000Z","size":75,"stargazers_count":74,"open_issues_count":5,"forks_count":18,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-09-19T03:16:56.605Z","etag":null,"topics":["debugger-toolbar","debugging-tool","middleware","psr-15","psr-7"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/php-middleware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-08-31T17:24:19.000Z","updated_at":"2024-06-30T22:05:57.000Z","dependencies_parsed_at":"2024-01-18T10:14:36.310Z","dependency_job_id":"68ad3cde-13bb-4fa1-b4ca-2cb46caa4653","html_url":"https://github.com/php-middleware/phpdebugbar","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-middleware%2Fphpdebugbar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-middleware%2Fphpdebugbar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-middleware%2Fphpdebugbar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-middleware%2Fphpdebugbar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php-middleware","download_url":"https://codeload.github.com/php-middleware/phpdebugbar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243493032,"owners_count":20299585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["debugger-toolbar","debugging-tool","middleware","psr-15","psr-7"],"created_at":"2024-07-30T18:00:25.479Z","updated_at":"2025-12-28T09:09:22.887Z","avatar_url":"https://github.com/php-middleware.png","language":"PHP","readme":"# phpdebugbar middleware [![Build Status](https://travis-ci.org/php-middleware/phpdebugbar.svg?branch=master)](https://travis-ci.org/php-middleware/phpdebugbar)\n[PHP Debug Bar](http://phpdebugbar.com/) as framework-agnostic [PSR-15 middleware](https://www.php-fig.org/psr/psr-15/) with [PSR-7 messages](https://www.php-fig.org/psr/psr-7/) created by [PSR-17 message factories](https://www.php-fig.org/psr/psr-17/). Also provides [PSR-11 container invokable factories](https://www.php-fig.org/psr/psr-11/).\n\nFramework-agnostic way to attach [PHP Debug Bar](http://phpdebugbar.com/) to your response (html or non-html!).\n\n## Installation\n\n```\ncomposer require --dev php-middleware/php-debug-bar\n```\n\nTo build middleware you need to inject `DebugBar\\JavascriptRenderer` (you can get it from `DebugBar\\StandardDebugBar`) inside `PhpDebugBarMiddleware` and add it into your middleware runner:\n\n```php\n$debugbar = new DebugBar\\StandardDebugBar();\n$debugbarRenderer = $debugbar-\u003egetJavascriptRenderer('/phpdebugbar');\n$middleware = new PhpMiddleware\\PhpDebugBar\\PhpDebugBarMiddleware($debugbarRenderer, $psr17ResponseFactory, $psr17StreamFactory);\n\n// or use provided factory\n$factory = new PhpMiddleware\\PhpDebugBar\\PhpDebugBarMiddlewareFactory();\n$middleware = $factory($psr11Container);\n\n$app = new MiddlewareRunner();\n$app-\u003eadd($middleware);\n$app-\u003erun($request, $response);\n```\n\nYou don't need to copy any static assets from phpdebugbar vendor!\n\n### How to force disable or enable PHP Debug Bar?\n\nSometimes you want to have control when enable or disable PHP Debug Bar:\n* custom content negotiation,\n* allow debug redirects responses.\n\nWe allow you to disable attaching phpdebugbar using `X-Enable-Debug-Bar: false` header, cookie or request attribute.\nTo force enable just send request with `X-Enable-Debug-Bar` header, cookie or request attribute with `true` value.\n\n### PSR-17\n\nThis 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](https://packagist.org/providers/psr/http-factory-implementation).\n\n#### ... and PSR-11\n\nIf you use provided PSR-11 factories, then your container must have services registered as PSR-17 interface's name. Example for [laminas-diactoros](https://github.com/laminas/laminas-diactoros) implementation and [Pimple](https://pimple.symfony.com/):\n\n```php\n$container[Psr\\Http\\Message\\ResponseInterface::class] = new Laminas\\Diactoros\\ResponseFactory();\n$container[Psr\\Http\\Message\\StreamFactoryInterface::class] = new Laminas\\Diactoros\\StreamFactory();\n```\n\n### How to install on Mezzio?\n\nYou need to register `PhpMiddleware\\PhpDebugBar\\ConfigProvider` and pipe provided middleware:\n\n```php\n$app-\u003epipe(\\PhpMiddleware\\PhpDebugBar\\PhpDebugBarMiddleware::class);\n```\n\nFor more - follow Mezzio [documentation](https://docs.mezzio.dev/mezzio/v3/features/modular-applications/).\n\n### How to install on Slim 3?\n\nRegister factories in container:\n\n```php\nforeach (ConfigProvider::getConfig()['dependencies']['factories'] as $key =\u003e $factory) {\n    $container[$key] = new $factory();\n}\n```\n\nand add middleware from container to app:\n\n```php\n$app-\u003eadd(\n    $app-\u003egetContainer()-\u003eget(\\PhpMiddleware\\PhpDebugBar\\PhpDebugBarMiddleware::class)\n);\n```\n\n### How to configure using existing factories?\n\nPut array with a configuration into `PhpMiddleware\\PhpDebugBar\\ConfigProvider` service in your container:\n\n```php\nreturn [\n    'phpmiddleware' =\u003e [\n        'phpdebugbar' =\u003e [\n            'javascript_renderer' =\u003e [\n                'base_url' =\u003e '/phpdebugbar',\n            ],\n            'collectors' =\u003e [\n                DebugBar\\DataCollector\\ConfigCollector::class, // Service names of collectors\n            ],\n            'storage' =\u003e null, // Service name of storage\n        ],\n    ],\n];\n```\n\nYou can override existing configuration by merge default configuration with your own (example):\n\n```php\nreturn array_merge(PhpMiddleware\\PhpDebugBar\\ConfigProvider::getConfig(), $myOverritenConfig);\n```\n\n## It's just works with any modern php framework!\n\nMiddleware tested on:\n* [Mezzio](https://github.com/mezzio/mezzio)\n* [Slim 3.x](https://github.com/slimphp/Slim)\n\nAnd any other modern framework [supported PSR-17 middlewares and PSR-7](https://mwop.net/blog/2015-01-08-on-http-middleware-and-psr-7.html).\n","funding_links":[],"categories":["Middleware"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-middleware%2Fphpdebugbar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp-middleware%2Fphpdebugbar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-middleware%2Fphpdebugbar/lists"}