php 如何安全地移除 Laravel Debugbar
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48220709/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to safely remove Laravel Debugbar
提问by Abdulla Nilam
I have a Laravel application that was not developed by me. There is some weird bar at the bottom of each page, it is some type of Laravel debugger tool.
我有一个不是我开发的 Laravel 应用程序。每个页面底部都有一些奇怪的栏,它是某种 Laravel 调试器工具。
I believe it is stored in storage/debugger. Is there a safe way I can go about checking to see if this is actually it and if so can I delete this type of tool without it affecting the application? Does anybody know what this thing is if so any advice on how to remove this safely would be greatly appreciated
我相信它存储在存储/调试器中。有没有一种安全的方法可以检查这是否真的是这样,如果是这样,我可以删除这种类型的工具而不影响应用程序吗?有没有人知道这是什么东西,如果有任何关于如何安全删除它的建议将不胜感激
回答by ArnSoos
Best option:
最佳选择:
Add DEBUGBAR_ENABLED=false
to your .env
添加DEBUGBAR_ENABLED=false
到您的.env
This has some advantages over Abdulla Nilam's answer:
这比 Abdulla Nilam 的回答有一些优势:
Debugbar is totally disabled
You can keep
APP_DEBUG=true
, hence still keep error details for local developmentIt is not tracked by git
调试栏完全禁用
您可以保留
APP_DEBUG=true
,因此仍然保留本地开发的错误详细信息它不被 git 跟踪
回答by Abdulla Nilam
回答by Yves
Remove Laravel Debugbar
删除 Laravel 调试栏
- If you want to totally remove the package, then do these steps:
- 如果您想完全删除包裹,请执行以下步骤:
$ composer remove vendor/barryvdh/laravel-debugbar
$ composer update
$ composer remove vendor/barryvdh/laravel-debugbar
$ composer update
Disable Laravel Debugbar
禁用 Laravel 调试栏
Option 1:Via Env File
选项 1:通过环境文件
- If you want disable the package, without it getting tracked by Git:
- 如果您想禁用该包,而不会被 Git 跟踪:
- Navigate to your
.env
file - And put
DEBUGBAR_ENABLED = FALSE
- 导航到您的
.env
文件 - 并放
DEBUGBAR_ENABLED = FALSE
Option 2:Via AppServiceProvider
选项 2:通过 AppServiceProvider
- FYI: This will be tracked by Git. - @Salam
- 仅供参考:这将由 Git 跟踪。- @萨拉姆
- Navigate to
app/Providers/AppServiceProvider.php
Put this code
\Debugbar::disable();
class AppServiceProvider extends ServiceProvider { public function boot() { \Debugbar::disable(); } }
- 导航
app/Providers/AppServiceProvider.php
把这个代码
\Debugbar::disable();
class AppServiceProvider extends ServiceProvider { public function boot() { \Debugbar::disable(); } }
回答by Googlian
Enabling/Disabling on run time.
在运行时启用/禁用。
You can enable or disable the debugbar during run time.
您可以在运行时启用或禁用调试栏。
Add this into your .env
file:
将此添加到您的.env
文件中:
DEBUGBAR_ENABLED = FALSE
In runtime:
在运行时:
\Debugbar::enable();
\Debugbar::disable();
Or remove everything
或删除所有内容
composer remove barryvdh/laravel-debugbar
composer remove barryvdh/laravel-debugbar
回答by Ohgodwhy
You can execute composer remove barryvdh/laravel-debugbar
to permanently remove it.
您可以执行composer remove barryvdh/laravel-debugbar
以永久删除它。
Note you can also just disable the debug bar if you don't want it:
请注意,如果您不想要它,您也可以禁用调试栏:
Just put \Debugbar::disable();
in your AppServiceProvider
.
只需放入\Debugbar::disable();
您的AppServiceProvider
.
回答by Florin
I am using this way:
我正在使用这种方式:
In config/debugbar.php
在 config/debugbar.php
'inject' => false, // this remove Inject Debugbar in Response
In this way I am keeping .php error enable.
通过这种方式,我保持 .php 错误启用。
Another way is to disable completely.
另一种方法是完全禁用。
'enabled' => false,
To enable just debug-bar and disable it for session and Ajax request
仅启用调试栏并为会话和 Ajax 请求禁用它
'enabled' => true,
....
....
'storage' => [
'enabled' => false, // DebugBar stores data for session/ajax requests.
or
或者
'capture_ajax' => false,
回答by Adam Kozlowski
I removed barryvdh/laravel-debugbar
from my composer.json
.
When I wanted to do composer install
or composer update
or even php artisan config:cache
I got error
我barryvdh/laravel-debugbar
从我的composer.json
. 当我想要做composer install
或者composer update
甚至是php artisan config:cache
我的错误
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Barryvdh\Debugbar\ServiceProvider' not found
If fact the solution was removing boostrap/cache/config.php
, because barryvdh/laravel-debugbar
was cached (php artisan config:cache
could not remove it)
如果解决方案正在删除boostrap/cache/config.php
,因为barryvdh/laravel-debugbar
已缓存(php artisan config:cache
无法删除)
Good luck!
祝你好运!
回答by bastiotutuama
It needs to be also removed in the providers: app/config/app.php
它也需要在提供者中删除: app/config/app.php
After:
后:
composer remove vendor/barryvdh/laravel-debugbar
composer update
composer remove vendor/barryvdh/laravel-debugbar
composer update
remove the line:
删除该行:
Barryvdh\Debugbar\ServiceProvider
in app/config/app.php.
Barryvdh\Debugbar\ServiceProvider
在app/config/app.php 中。
Also these folders can be deleted:
也可以删除这些文件夹:
app/config/packages/barryvdh/laravel-debugbar/config.php
- another Debugbar-related file somewhere under
app/storage/...
app/config/packages/barryvdh/laravel-debugbar/config.php
- 下某处的另一个与调试栏相关的文件
app/storage/...