- Upgrade Pest to v3
- Drop Laravel 10 support and fixed CI
- Made datetime format of formatted header configurable and added TZ offset to default format
Y-m-d H:i:s P
. - Fix | Prevent duplicate logging when a console command is called from a regular web request (e.g. programmatically executing an Artisan command with
Artisan::call()
). In web context, we're now only logging onRequestHandled
event, while in console only onCommandFinished
event.
- The
Writer
object now has a staticshouldReportSqlQuery()
method to define a custom callback for filtering queries included in theQueryLogWritten
event. by @pascalbaljet in #4 - The
SqlQuery
object is now areadonly
class, and all the getter methods have been removed. This is a breaking change. - The
SqlQuery
object now includes the unprepared query and bindings. - Added tests for the reporting mechanism and the
QueryLogWritten
event - Drops support for PHP 8.1
- Fix | It now runs the whole test suite with a single
vendor/bin/pest
command. by @pascalbaljet in #3 - Moved
FormatterTest
andSqlLoggerTest
to the Feature directory as they're interacting with the app container. - Single
Request
mock inFormatterTest
.
- Feature | Dispatch
QueryLogWritten
event after writing queries to the log, so that the whole query log can be accessed for further processing, e.g. generating reports/notifications. - Feature | Added auth guard to log headers.
- Laravel 11 support.
- Migrated to Pest for testing (by @pascalbaljet in #2)
- Added GitHub Actions for all supported Laravel and PHP versions.
- Introduced
orchestra/testbench
dev dependency instead of the whole Laravel framework. - Improved Service Provider: fixed the publish tag and use the regular base
ServiceProvider
. - Improved
WriterTest
by not mocking theConfig
class but using the real config values.
- Drop Laravel 9 support, require Laravel v10.15 or higher for the new
DB::getRawQueryLog()
support. - PHP code style fixes by
laravel/pint
v1.10, now using more strict style rules (laravel
preset). - Refactored whole codebase from
DB::getQueryLog()
to use the newDB::getRawQueryLog()
method, soReplacesBindings
is no longer needed. - Replaced torann/geoip by stevebauman/location for optional GeoIP support.
- Improved username detection in
Formatter
headers, so that it works both with defaultemail
field or customusername()
method onUser
model.
- Allow bindings to be null.
- Drop Laravel 8 / PHP 8.0 support
- Integrated
laravel/pint
as dev requirement for PHP style fixing - Support Laravel 10
- Support Laravel 9
- Added some function return types and cleaned up phpdoc comments.
- Added new config param
queries.exclude_pattern
(env varSQL_REPORTER_QUERIES_EXCLUDE_PATTERN
) to narrow down queries to be logged without bloating include pattern regex. - Added unit tests for
Writer
, testing query include/exclude patterns and min exec time. - Renamed
SQL_REPORTER_QUERIES_PATTERN
env var toSQL_REPORTER_QUERIES_INCLUDE_PATTERN
- Renamed methods in
Writer
for clarity. - Improved testability of
Writer::writeQuery()
by returning true if query was written to log.
- Initial release