Skip to content

Commit cd58b8f

Browse files
committed
update README.md
1 parent 7640308 commit cd58b8f

File tree

1 file changed

+46
-2
lines changed

1 file changed

+46
-2
lines changed

README.md

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,56 @@
44
* Laravel 5.5+
55

66
## Installation
7-
Install the package
7+
You can install the package via composer:
88
```bash
99
composer require ilzrv/laravel-slow-query-detector
1010
```
1111

12-
Publish the configuration file
12+
## Configuration
13+
By default, the package is already configured and enabled, but you can change the settings if necessary.
14+
To publish the configuration file, run:
1315
```bash
1416
php artisan vendor:publish --provider="Ilzrv\LaravelSlowQueryDetector\ServiceProvider"
1517
```
18+
19+
### `SQD_ENABLED`
20+
Determines whether query listening is enabled.
21+
22+
### `SQD_CODE_MAX_QUERIES`
23+
Maximum number of queries when processing the controller method.
24+
If your method executes more queries than this value the notification will be received.
25+
26+
### `SQD_CODE_MAX_TIME`
27+
Maximum execution time of the controller method (in ms).
28+
If your method takes longer than this value to complete the notification will be received.
29+
30+
### `SQD_QUERY_BINDINGS`
31+
Queries with bindings.
32+
If true then bindings will be applied to queries in notification.
33+
Example (if true): `select * from users where name = John` instead of `select * from users where name = ?`
34+
35+
### `SQD_QUERY_MAX_TIME`
36+
Maximum execution time for each query in DB (in ms).
37+
If at least one query exceeds this value
38+
you will receive a notification.
39+
40+
## Example logs output:
41+
```bash
42+
[2020-04-12 06:59:21] production.CRITICAL: Array
43+
(
44+
[SQD] => Array
45+
(
46+
[Execution Time] => 60 ms.
47+
[Queries Count] => 2
48+
[Heavy Queries Count] => 2
49+
[Full URL] => https://example.org/?name=John
50+
[Action] => App\Http\Controllers\HomeController@index
51+
[Heaviest Query] => Array
52+
(
53+
[Query] => select * from `users` where `name` = John
54+
[Time] => 50.67 ms.
55+
)
56+
57+
)
58+
)
59+
```

0 commit comments

Comments
 (0)