Query Logging | Web app | Chrome DevTool | Code |
---|---|---|---|
Use cache driver | |||
Eloquent Queries | |||
Routes | |||
Stack trace | |||
Tinker Support | |||
Job Support | |||
MySql Support | |||
Start session | Start Session | ||
Stop session | Stop Session | ||
Export Session | |||
Import Session | |||
Query Grouping | |||
Query Ordering | |||
Explain Query | |||
Re-execute Query | |||
Copy to clipboard | |||
Show realtime query usage | |||
dd query builder query | |||
dump query builder query | |||
dd eloquent model query | |||
dump eloquent model query |
You can install the package via composer:
composer require socialblue/laravel-query-adviser --dev
Publish Laravel-Query-Adviser
php artisan vendor:publish --provider="Socialblue\LaravelQueryAdviser\LaravelQueryAdviserServiceProvider"
Publish the front-end application after updating
php artisan vendor:publish --tag=public --force
When updating from 0.13.2
to 0.14.0
please use
php artisan vendor:publish --provider="Socialblue\LaravelQueryAdviser\LaravelQueryAdviserServiceProvider" --force
When you want to be able to start and stop the log sessions and see realtime query information from your current browser tab. You can install the Chrome developer tool in the Chrome web store.
Dump and die
User::join('posts', 'posts.users_id', '=', 'users.id') ->select([DB::raw('SUM(posts.id)')]) ->where('users.id', 1) ->select([DB::raw('SUM(post.id)')])->qadd();or just dump
User::join('posts', 'posts.users_id', '=', 'users.id') ->select([DB::raw('SUM(posts.id)')]) ->where('users.id', 1) ->select([DB::raw('SUM(post.id)')])->qadump();both dump this array
[ 'toSql' => 'select sum(posts.id) from users join posts on posts.users_id = users.id where users.id = ?' 'bindings' => [1] 'query' => 'select sum(posts.id) from users join posts on posts.users_id = users.id where users.id = 1' ]
- To start a query log session goto {app_url}/query-adviser/
- Press play and open the pages of your app you want to log the queries of
- Stop the session and click on the session bar to see all the details.
collapse and expand the panels for less or more information about the queries executed in that time frame.
You can group the queries by time, routes and rawQuery. Also you can clear the cached queries by pressing the eject button.
group by time, routes, referer, raw queries, queries with bindings, and query time
Sort the time line by last inserted, slowest query, and most occurrences
Re-execute a query, get query information, and copy the query to your clipboard
As of version 0.10.0, the query card has labels related to the class, file and function of the query executed from your app folder.
Open the explain dialog to see more information about the query.
composer test
Please see CONTRIBUTING for details.
If you discover any security related issues, please email mark.broersen@outlook.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
This package was generated using the Laravel Package Boilerplate.