Skip to content

Commit 7598916

Browse files
committed
updated README
1 parent d9baf3c commit 7598916

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
/vendor/
33
/.idea
44
/composer.lock
5+
/tests/_coverage

README.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
This module allows you to log SQL queries to log file in Laravel framework. It's useful mainly
88
when developing your application to verify whether your queries are valid and to make sure your application doesn't run too many or too slow database queries.
99

10-
It reports a lot of metadata like total query count, total execution time, origin (request URL/console command), authenticated user, app environment, client browser agent / IP / hostname. You're also able to limit queries by a regex pattern, so you could e.g. only log
10+
You may also use this in production as it should not cause a lot of overhead. Logged queries can be limited by query pattern, and logging only occurs at the end of each request or artisan command execution.
11+
12+
It reports a lot of metadata like total query count, total execution time, origin (request URL/console command), authenticated user, app environment, client browser agent / IP / hostname.
1113

1214
## Installation
1315

@@ -25,7 +27,7 @@ It reports a lot of metadata like total query count, total execution time, origi
2527
$ php artisan vendor:publish --provider="Onlime\LaravelSqlReporter\Providers\ServiceProvider"
2628
```
2729

28-
By default you should not edit published file because all the settings are loaded from `.env` file by default.
30+
By default, you should not edit published file because all the settings are loaded from `.env` file by default.
2931

3032
3. In your `.env` file add the following entries:
3133

@@ -55,7 +57,7 @@ It reports a lot of metadata like total query count, total execution time, origi
5557
5658
To find out more about those setting please take a look at [Configuration file](config/sql-reporter.php)
5759
58-
4. Make sure directory specified in `.env` file exists in storage path and you have valid file permissions to create and modify files in this directory (If it does not exist this package will automatically create it when needed but it's recommended to create it manually with valid file permissions)
60+
4. Make sure directory specified in `.env` file exists in storage path, and you have valid permissions to create and modify files in this directory (If it does not exist this package will automatically create it when needed, but it's recommended to create it manually with valid file permissions)
5961

6062
5. Make sure on live server you will set logging SQL queries to false in your `.env` file: `SQL_REPORTER_QUERIES_ENABLED=false`. This package is recommended to be used only for development to not impact production application performance.
6163

@@ -68,6 +70,23 @@ $ composer require torann/geoip
6870
$ php artisan vendor:publish --provider="Torann\GeoIP\GeoIPServiceProvider"
6971
```
7072

73+
It will be auto-detected, no configuration needed for this.
74+
75+
## Development
76+
77+
Checkout project and run tests:
78+
79+
```bash
80+
$ git clone https://github.com/onlime/laravel-sql-reporter.git
81+
$ cd laravel-sql-reporter
82+
$ composer install
83+
84+
# run unit tests
85+
$ vendor/bin/phpunit
86+
# run unit tests with coverage report
87+
$ XDEBUG_MODE=coverage vendor/bin/phpunit
88+
```
89+
7190
## FAQ
7291

7392
### How does this package differ from `mnabialek/laravel-sql-logger` ?
@@ -124,9 +143,16 @@ Please star his great package on GitHub! You may use `composer thanks` for this.
124143
125144
All changes are listed in [CHANGELOG](CHANGELOG.md)
126145
146+
## Caveats
147+
148+
- If your application crashes, this package will not log any queries, as logging is only triggered at the end. As alternative, you could use [mnabialek/laravel-sql-logger](https://github.com/mnabialek/laravel-sql-logger) which triggers sql logging on each query execution.
149+
- It's currently not possible to log slow queries into a separate logfile. I wanted to keep that package simpel.
150+
127151
## Todo
128152

153+
- [ ] Improve unit testing to reach 100% coverage
129154
- [ ] Add browser type information to log headers, using hisorange/browser-detect
155+
- [ ] Support for Lumen
130156

131157
## License
132158

0 commit comments

Comments
 (0)