The answer comes from https://segmentfault.com/q/1010000007716945.
First Floor:
Go to https://packagist.org to search for the keywords you want, such as checkingdebugbar
The list has a description, in fact, can be seen at a glance barryvdh/laravel-debugbar
, open follow the instructions to do it.
Let me take a walk for you:
1 installation, Terminal enters your laravel project root directory, installs through composer
Composer require Barryvdh/laravel-debugbar
2 Allow Laravel to load the service provider class of the package when it is started
This package is based on maximebf/debugbar
a package for laravel to do a component, itself has been written to the service provider registration binding on the Laravel container, we just app/config.php
add in the providers
t its service provider class, let Laravel start loading it
Barryvdh\debugbar\serviceprovider::class,
More specific to the study, you can see it on GitHub Note: https://github.com/barryvdh/l ... There are detailed configuration and usage for laravel and lumen.
However, for the debugging of some methods and to see if the code corresponding to the SQL OK, php artisan tinker
it will be faster and more convenient, you can listen in the Tinker$query
? PHP artisan tinkerpsy Shell v0. 7.2 7.0. A -cli) by Justin Hileman>>> db::listen (function ($query) {var_dump ($query-sql);}); NULL
For example, take a comment on a post
>>> $postcomments;string( the)"SELECT * from"Comments"where"Comments"."post_id" = ?and"Comments"."post_id" isNotNULL"(This shows the SQL)= = Illuminate\database\eloquent\collection {#623All : [app\comment {#638ID:"1", post_id:"1", Content:"Some Comment for the post", Created_at:"2016-11-15 01:07:53", Updated_at:"2016-11-15 01:07:53", },
Second floor:
I see the main problem again.
Composer require Barryvdh/laravel-debugbar
Add to
config/app.php
' providers ' = = [ ... Barryvdh\debugbar\serviceprovider::class,]
Third floor:
In addition to composer require Barryvdh/debugbar,phpstrom and IDE pluginscomposer require barryvdh/laravel-ide-helper
If you do not want to install the plugin, add the code
\db::listen (function ($sql, $query) { dump ($sql, $query);
Four floor:
Debugbar
Trace function in laravel similar to thinkphp