rokde/laravel-query-analyzer

This package is abandoned and no longer maintained. No replacement package was suggested.

Query Analyzer for Laravel

0.0.1 2016-06-28 14:36 UTC

This package is auto-updated.

Last update: 2023-03-23 02:42:39 UTC


README

Latest Stable Version Latest Unstable Version License Total Downloads

Quickstart

composer require rokde/laravel-query-analyzer

Add to providers in config/app.php:

Rokde\LaravelQueryAnalyzer\LaravelQueryAnalyzerProvider::class,

Installation

Add to your composer.json following lines

"require": {
	"rokde/laravel-query-analyzer": "~0.0"
}

Add Rokde\LaravelQueryAnalyzer\LaravelQueryAnalyzerProvider::class, to providers in config/app.php.

Run php artisan vendor:publish --provider="Rokde\LaravelQueryAnalyzer\LaravelQueryAnalyzerProvider"

Configuration

enabled

Is the analyzing enabled or not.

Usage

You have a console command to get all queries listed.

List all queries

$> php artisan analyze:queries

Lists all queries. You have --limit and --offset as options for paginate through all the queries.

Example output:

01 select * from `users` where `users`.`id` = ? limit 1
02 select * from `profiles` where `profiles`.`user_id` = ? and `profiles`.`user_id` is not null

List details of one query

$> php artisan analyze:queries 1

Lists details for query number 1.

Example output:

select * from `users` where `users`.`id` = ? limit 1
+-------+---------+---------+------+------+
| count | fastest | slowest | avg  | mode |
+-------+---------+---------+------+------+
| 14    | 0.4     | 0.73    | 0.53 | 0.58 |
+-------+---------+---------+------+------+

+----------+---------+---------+------+------+
| bindings | fastest | slowest | avg  | mode |
+----------+---------+---------+------+------+
| [1]      | 0.4     | 0.73    | 0.53 | 0.58 |
| [2]      | 0.41    | 0.74    | 0.54 | 0.59 |
+----------+---------+---------+------+------+

You can see the summary of all queries combined and afterwards the bindings-dependent timings. Maybe some bindings cause an extra long run.

Clear the data

$> php artisan analyze:clear

Clears the whole data for analysis.