php Laravel 5:启用laravel-debugbar
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30012021/
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
Laravel 5: Enable laravel-debugbar
提问by Steve
I'm using Laravel 5 and would like to use the barryvdh/laravel-debugbar. After the installation and configuration the bar is not showing.
我正在使用 Laravel 5 并想使用 barryvdh/laravel-debugbar。安装和配置后,栏不显示。
I did the following:
我做了以下事情:
Installation:
安装:
composer require barryvdh/laravel-debugbar
Add the following lines to the config/app.php
将以下行添加到 config/app.php
'Barryvdh\Debugbar\ServiceProvider',
'Debugbar' => 'Barryvdh\Debugbar\Facade',
Further I execute:
我进一步执行:
php artisan vendor:publish
which generates the debugbar.php file within the config folder.
它会在 config 文件夹中生成 debugbar.php 文件。
Any ideas what could be missing?
任何想法可能会丢失什么?
Thank you
谢谢
UPDATE:
更新:
I made a fresh Laravel 5 installation and installed the debugbar which works perfectly and showed my the debugbar. After executing the artisan commands:
我进行了全新的 Laravel 5 安装并安装了完美运行的调试栏并显示了我的调试栏。执行工匠命令后:
php artisan cache:clear
and
和
php artisan config:cache
the debugbar is not visible anymore. I think this was also my problem of the previous question. Any ideas why this happens and how I can make the debugbar revisible?Thank you
调试栏不再可见。我想这也是我上一个问题的问题。任何想法为什么会发生这种情况以及如何使调试栏可修改?谢谢
回答by ?ukasz D. Tulikowski
Try this command
试试这个命令
php artisan config:clear
回答by Remluben
The installation instructions at https://github.com/barryvdh/laravel-debugbar#installationrecommend setting the application debug mode to true. Also make sure, that you do not disable the debugbar in config/debugbar.php by setting the enabled=false> If I were you I would simply remove it. ( The debugbar won't work, event if the application itself is in debug mode )
https://github.com/barryvdh/laravel-debugbar#installation 上的安装说明建议将应用程序调试模式设置为 true。还要确保您没有通过设置enabled=false禁用 config/debugbar.php 中的调试栏> 如果我是您,我会简单地将其删除。(如果应用程序本身处于调试模式,调试栏将不起作用,事件)
Another suggestion
另一个建议
As far as I know the .env.examplefile should be renamed to .envand all apropriate variables should be set. In my case it always contains lines like this:
据我所知.env.example文件应该重命名为.env并且应该设置所有适当的变量。在我的情况下,它总是包含这样的行:
APP_ENV=local
APP_DEBUG=true`
Within the config/app.php file the debug value should be read from the environment variable.
在 config/app.php 文件中,应该从环境变量中读取调试值。
return [
/* some other config values here... */
'debug' => env('APP_DEBUG'),
]
Note, that it should also be possible to simply set the value to truewithout using the environment based configuration values.
请注意,也应该可以简单地将该值设置为true,而不使用基于环境的配置值。
Maybe you can test it by manually calling \Debugbar::enable(); in one of your routes and debugging afterwards.
也许您可以通过手动调用 \Debugbar::enable(); 来测试它。在您的路线之一中,然后进行调试。
Hope this helps.
希望这可以帮助。
回答by Muihlinn
I have had the same trouble, and it is usually solved clearing route caching.
我也遇到过同样的问题,一般都是通过清除路由缓存来解决的。
php artisan route:clear
php artisan route:clear
It seemed to be an issue which was already fixed, and you can find about it in the repository issue #287, but I'm still finding it from time to time.
这似乎是一个已经修复的问题,您可以在存储库问题 #287 中找到它,但我仍然不时找到它。
回答by karthik
Paste this lines in your Config/app.php
surely it will work
将此行粘贴到您Config/app.php
肯定会起作用
- In providers:
- 在提供者中:
Barryvdh\Debugbar\ServiceProvider::class,
Barryvdh\Debugbar\ServiceProvider::class,
- In aliases:
- 在别名中:
'Debugbar' => Barryvdh\Debugbar\Facade::class,
'Debugbar' => Barryvdh\Debugbar\Facade::class,
回答by Shabeer Sha
Open the terminal and to do like this as your wise
打开终端并按照您的智慧这样做
1) Install DebugBar
1) 安装调试栏
- The DebugBar 2.4.x is for Laravel 5.4-
- The DebugBar 3.0.x is for Laravel 5.5+
- DebugBar 2.4.x 适用于Laravel 5.4-
- DebugBar 3.0.x 适用于Laravel 5.5+
A) Install the debuger 2.4 (Documentation)
A) 安装调试器 2.4(文档)
composer require barryvdh/laravel-debugbar:~2.4
You will also need to add in providers
array in config/app.php
:
您还需要在providers
数组中添加config/app.php
:
Barryvdh\Debugbar\ServiceProvider::class
B) Install the debuger 3.0 (Documentation)
B) 安装调试器 3.0(文档)
composer require barryvdh/laravel-debugbar --dev
2) After that, you need to update the composer
2)之后,您需要更新作曲家
composer update
3) Then after you need to add a line to .env
file
3)然后在您需要向.env
文件添加一行之后
APP_DEBUG=true
4) Clear cache and config
4)清除缓存和配置
php artisan cache:clear
php artisan config:cache
回答by Sebastien Horin
In my case, the problem was I had a wide route, Route::get('/{all?}','...')
catching the debugbar one.
就我而言,问题是我的路线很宽,可以Route::get('/{all?}','...')
抓住调试栏。
I managed to solve this by adding these routes before:
我之前通过添加这些路由设法解决了这个问题:
Route::get( '/api/_debugbar/assets/stylesheets', '\Barryvdh\Debugbar\Controllers\AssetController@css' );
Route::get( '/api/_debugbar/assets/javascript', '\Barryvdh\Debugbar\Controllers\AssetController@js' );
回答by Sergio B.
I had the same issue and tried all the previous solutions without success. Finnaly I solved my problem with the following detail fix:
我遇到了同样的问题,并尝试了所有以前的解决方案,但都没有成功。最后,我通过以下详细修复解决了我的问题:
安装说明:
If you use a catch-all/fallback route, make sure you load the Debugbar ServiceProvider before your own App ServiceProviders.
如果您使用全能/回退路由,请确保在您自己的 App ServiceProvider 之前加载 Debugbar ServiceProvider。
回答by jay ramone
I had this issue because I had catchall route in routes.php
我遇到了这个问题,因为我在 routes.php 中有包罗万象的路由
Here was my fix:
这是我的修复:
- comment out the catchall route code block in routes.php
clear the cache
c:path/to/your/project> php artisan cache:clear
c:path/to/your/project> php artisan route:clear
load your poject home page in your browser and confirm that you can see the debugbar
- uncomment out the catchall route in routes.php
- 注释掉routes.php中的catchall route代码块
清除缓存
c:path/to/your/project> php artisan cache:clear
c:path/to/your/project> php artisan route:clear
在浏览器中加载您的项目主页并确认您可以看到调试栏
- 在routes.php 中取消注释catchall 路由
Hopefully this helps someone else.
希望这对其他人有帮助。
回答by user570605
Check your storage/laravel.logfile. In mine was:
检查您的storage/laravel.log文件。在我的是:
local.ERROR: Debugbar exception: Authentication user provider [] is not defined.
Because I misconfigured something in auth.php and when I fixed that debugbar loaded successfully.
因为我在 auth.php 中错误配置了一些东西,当我修复了调试栏时,成功加载了。
回答by Gabriel Gressie
If you're daft like me sometimes this can help. At the bottom of your page, make sure you don't write a but use the full closure eg. This was my problem.
如果你像我一样愚蠢,有时这会有所帮助。在你的页面底部,确保你没有写 a 而是使用完整的闭包,例如。这是我的问题。