{"id":13395897,"url":"https://github.com/barryvdh/laravel-debugbar","last_synced_at":"2026-01-05T23:17:22.202Z","repository":{"id":37276074,"uuid":"12615154","full_name":"barryvdh/laravel-debugbar","owner":"barryvdh","description":"Debugbar for Laravel (Integrates PHP Debug Bar)","archived":false,"fork":false,"pushed_at":"2025-04-25T08:39:30.000Z","size":14479,"stargazers_count":18237,"open_issues_count":102,"forks_count":1576,"subscribers_count":279,"default_branch":"master","last_synced_at":"2025-05-05T14:09:23.277Z","etag":null,"topics":["debugbar","developer-tool","hacktoberfest","laravel","profiler","toolbar"],"latest_commit_sha":null,"homepage":"http://laraveldebugbar.com/","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/barryvdh.png","metadata":{"files":{"readme":"readme.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"barryvdh","custom":["https://fruitcake.nl"]}},"created_at":"2013-09-05T10:26:54.000Z","updated_at":"2025-05-05T11:38:13.000Z","dependencies_parsed_at":"2024-03-14T22:48:49.409Z","dependency_job_id":"d3b1a51c-448c-4db7-8a03-53086c6493b0","html_url":"https://github.com/barryvdh/laravel-debugbar","commit_stats":{"total_commits":1059,"total_committers":227,"mean_commits":4.665198237885463,"dds":0.392823418319169,"last_synced_commit":"ed9a30596404e4edc430f1756c14ab90d0da52c1"},"previous_names":[],"tags_count":169,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barryvdh%2Flaravel-debugbar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barryvdh%2Flaravel-debugbar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barryvdh%2Flaravel-debugbar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barryvdh%2Flaravel-debugbar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/barryvdh","download_url":"https://codeload.github.com/barryvdh/laravel-debugbar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253773916,"owners_count":21962194,"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":["debugbar","developer-tool","hacktoberfest","laravel","profiler","toolbar"],"created_at":"2024-07-30T18:00:35.258Z","updated_at":"2026-01-05T23:17:22.196Z","avatar_url":"https://github.com/barryvdh.png","language":"PHP","funding_links":["https://github.com/sponsors/barryvdh","https://fruitcake.nl"],"categories":["Popular Packages","Uncategorized","Tools","Notable Packages","PHP","Paquetes utiles","Tooling","Developer \u0026 Debugging Tools","Developer Tools","后端开发框架及项目","Laravel-Auth","Twig","Packages","插件推荐","调试和性能( Debugging and Profiling )","Development","Popular/Notable Packages","Debugging \u0026 Performance","武器库"],"sub_categories":["Uncategorized","Debug","PHP开发","Environment File","Extensions","Development Tools","Frameworks","Addons","后端"],"readme":"## Debugbar for Laravel\n![Unit Tests](https://github.com/barryvdh/laravel-debugbar/workflows/Unit%20Tests/badge.svg)\n[![Packagist License](https://img.shields.io/badge/Licence-MIT-blue)](http://choosealicense.com/licenses/mit/)\n[![Latest Stable Version](https://img.shields.io/packagist/v/barryvdh/laravel-debugbar?label=Stable)](https://packagist.org/packages/barryvdh/laravel-debugbar)\n[![Total Downloads](https://img.shields.io/packagist/dt/barryvdh/laravel-debugbar?label=Downloads)](https://packagist.org/packages/barryvdh/laravel-debugbar)\n[![Fruitcake](https://img.shields.io/badge/Powered%20By-Fruitcake-b2bc35.svg)](https://fruitcake.nl/)\n\nThis is a package to integrate [PHP Debug Bar](https://github.com/php-debugbar/php-debugbar) with Laravel.\nIt includes a ServiceProvider to register the debugbar and attach it to the output. You can publish assets and configure it through Laravel.\nIt bootstraps some Collectors to work with Laravel and implements a couple custom DataCollectors, specific for Laravel.\nIt is configured to display Redirects and Ajax/Livewire Requests. (Shown in a dropdown)\nRead [the documentation](http://phpdebugbar.com/docs/) for more configuration options.\n\n![Debugbar Dark Mode screenshot](https://github.com/barryvdh/laravel-debugbar/assets/973269/6600837a-8b2d-4acb-ab0c-158c9ca5439c)\n\n\u003e [!CAUTION]\n\u003e Use the DebugBar only in development. Do not use Debugbar on publicly accessible websites, as it will leak information from stored requests (by design).\n\n\u003e [!WARNING]\n\u003e  It can also slow the application down (because it has to gather and render data). So when experiencing slowness, try disabling some of the collectors.\n\nThis package includes some custom collectors:\n - QueryCollector: Show all queries, including binding + timing\n - RouteCollector: Show information about the current Route.\n - ViewCollector: Show the currently loaded views. (Optionally: display the shared data)\n - EventsCollector: Show all events\n - LaravelCollector: Show the Laravel version and Environment. (disabled by default)\n - SymfonyRequestCollector: replaces the RequestCollector with more information about the request/response\n - LogsCollector: Show the latest log entries from the storage logs. (disabled by default)\n - FilesCollector: Show the files that are included/required by PHP. (disabled by default)\n - ConfigCollector: Display the values from the config files. (disabled by default)\n - CacheCollector: Display all cache events. (disabled by default)\n\nBootstraps the following collectors for Laravel:\n - LogCollector: Show all Log messages\n - SymfonyMailCollector for Mail\n\nAnd the default collectors:\n - PhpInfoCollector\n - MessagesCollector\n - TimeDataCollector (With Booting and Application timing)\n - MemoryCollector\n - ExceptionsCollector\n\nIt also provides a facade interface (`Debugbar`) for easy logging Messages, Exceptions and Time\n\n## Installation\n\nRequire this package with composer. It is recommended to only require the package for development.\n\n```shell\ncomposer require barryvdh/laravel-debugbar --dev\n```\n\nLaravel uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.\n\nThe Debugbar will be enabled when `APP_DEBUG` is `true`.\n\n\u003e If you use a catch-all/fallback route, make sure you load the Debugbar ServiceProvider before your own App ServiceProviders.\n\n### Laravel without auto-discovery:\n\nIf you don't use auto-discovery, add the ServiceProvider to the providers list. For Laravel 11 or newer, add the ServiceProvider in bootstrap/providers.php. For Laravel 10 or older, add the ServiceProvider in config/app.php.\n\n```php\nBarryvdh\\Debugbar\\ServiceProvider::class,\n```\n\nIf you want to use the facade to log messages, add this within the `register` method of `app/Providers/AppServiceProvider.php` class:\n\n```php\npublic function register(): void\n{\n    if (class_exists(\\Barryvdh\\Debugbar\\Facades\\Debugbar::class)) {\n        $loader = \\Illuminate\\Foundation\\AliasLoader::getInstance();\n        $loader-\u003ealias('Debugbar', \\Barryvdh\\Debugbar\\Facades\\Debugbar::class);\n    }\n}\n```\n\nThe profiler is enabled by default, if you have APP_DEBUG=true. You can override that in the config (`debugbar.enabled`) or by setting `DEBUGBAR_ENABLED` in your `.env`. See more options in `config/debugbar.php`\nYou can also set in your config if you want to include/exclude the vendor files also (FontAwesome, Highlight.js and jQuery). If you already use them in your site, set it to false.\nYou can also only display the js or css vendors, by setting it to 'js' or 'css'. (Highlight.js requires both css + js, so set to `true` for syntax highlighting)\n\n#### Copy the package config to your local config with the publish command:\n\n```shell\nphp artisan vendor:publish --provider='Barryvdh\\Debugbar\\ServiceProvider'\n```\n\n### Laravel with Octane:\n\nMake sure to add LaravelDebugbar to your flush list in `config/octane.php`.\n\n```php\n    'flush' =\u003e [\n        \\Barryvdh\\Debugbar\\LaravelDebugbar::class,\n    ],\n```\n\n## Usage\n\nYou can now add messages using the Facade (when added), using the PSR-3 levels (debug, info, notice, warning, error, critical, alert, emergency):\n\n```php\nDebugbar::info($object);\nDebugbar::error('Error!');\nDebugbar::warning('Watch out…');\nDebugbar::addMessage('Another message', 'mylabel');\n```\n\nAnd start/stop timing:\n\n```php\nDebugbar::startMeasure('render','Time for rendering');\nDebugbar::stopMeasure('render');\nDebugbar::addMeasure('now', LARAVEL_START, microtime(true));\nDebugbar::measure('My long operation', function() {\n    // Do something…\n});\n```\n\nOr log exceptions:\n\n```php\ntry {\n    throw new Exception('foobar');\n} catch (Exception $e) {\n    Debugbar::addThrowable($e);\n}\n```\n\nThere are also helper functions available for the most common calls:\n\n```php\n// All arguments will be dumped as a debug message\ndebug($var1, $someString, $intValue, $object);\n\n// `$collection-\u003edebug()` will return the collection and dump it as a debug message. Like `$collection-\u003edump()`\ncollect([$var1, $someString])-\u003edebug();\n\nstart_measure('render','Time for rendering');\nstop_measure('render');\nadd_measure('now', LARAVEL_START, microtime(true));\nmeasure('My long operation', function() {\n    // Do something…\n});\n```\n\nIf you want you can add your own DataCollectors, through the Container or the Facade:\n\n```php\nDebugbar::addCollector(new DebugBar\\DataCollector\\MessagesCollector('my_messages'));\n//Or via the App container:\n$debugbar = App::make('debugbar');\n$debugbar-\u003eaddCollector(new DebugBar\\DataCollector\\MessagesCollector('my_messages'));\n```\n\nBy default, the Debugbar is injected just before `\u003c/body\u003e`. If you want to inject the Debugbar yourself,\nset the config option 'inject' to false and use the renderer yourself and follow http://phpdebugbar.com/docs/rendering.html\n\n```php\n$renderer = Debugbar::getJavascriptRenderer();\n```\n\nNote: Not using the auto-inject, will disable the Request information, because that is added After the response.\nYou can add the default_request datacollector in the config as alternative.\n\n## Enabling/Disabling on run time\nYou can enable or disable the debugbar during run time.\n\n```php\n\\Debugbar::enable();\n\\Debugbar::disable();\n```\n\nNB. Once enabled, the collectors are added (and could produce extra overhead), so if you want to use the debugbar in production, disable in the config and only enable when needed.\n\n## Storage\n\nDebugbar remembers previous requests, which you can view using the Browse button on the right. This will only work if you enable `debugbar.storage.open` in the config. \nMake sure you only do this on local development, because otherwise other people will be able to view previous requests.\nIn general, Debugbar should only be used locally or at least restricted by IP.\nIt's possible to pass a callback, which will receive the Request object, so you can determine access to the OpenHandler storage.\n\n## Twig Integration\n\nLaravel Debugbar comes with two Twig Extensions. These are tested with [rcrowe/TwigBridge](https://github.com/rcrowe/TwigBridge) 0.6.x\n\nAdd the following extensions to your TwigBridge config/extensions.php (or register the extensions manually)\n\n```php\n'Barryvdh\\Debugbar\\Twig\\Extension\\Debug',\n'Barryvdh\\Debugbar\\Twig\\Extension\\Dump',\n'Barryvdh\\Debugbar\\Twig\\Extension\\Stopwatch',\n```\n\nThe Dump extension will replace the [dump function](http://twig.sensiolabs.org/doc/functions/dump.html) to output variables using the DataFormatter. The Debug extension adds a `debug()` function which passes variables to the Message Collector,\ninstead of showing it directly in the template. It dumps the arguments, or when empty; all context variables.\n\n```twig\n{{ debug() }}\n{{ debug(user, categories) }}\n```\n\nThe Stopwatch extension adds a [stopwatch tag](http://symfony.com/blog/new-in-symfony-2-4-a-stopwatch-tag-for-twig)  similar to the one in Symfony/Silex Twigbridge.\n\n```twig\n{% stopwatch \"foo\" %}\n    …some things that gets timed\n{% endstopwatch %}\n```\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=barryvdh/laravel-debugbar\u0026type=Date)](https://www.star-history.com/#barryvdh/laravel-debugbar\u0026Date)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarryvdh%2Flaravel-debugbar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarryvdh%2Flaravel-debugbar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarryvdh%2Flaravel-debugbar/lists"}