Skip to content

Commit aa095cf

Browse files
committed
updated badges and added ci-coverage Github workflow
1 parent c0ff375 commit aa095cf

File tree

2 files changed

+35
-7
lines changed

2 files changed

+35
-7
lines changed

.github/workflows/ci-coverage.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: CI-coverage
2+
3+
on: [push]
4+
5+
jobs:
6+
build-test:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v2
11+
12+
- uses: php-actions/composer@v5
13+
14+
- name: PHPUnit Tests
15+
uses: php-actions/phpunit@v2
16+
with:
17+
php_extensions: xdebug
18+
configuration: phpunit.xml
19+
args: --coverage-text
20+
env:
21+
XDEBUG_MODE: coverage

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# Laravel SQL Reporter
22

33
[![Packagist](https://img.shields.io/packagist/dt/onlime/laravel-sql-reporter.svg)](https://packagist.org/packages/onlime/laravel-sql-reporter)
4-
[![Build Status](https://travis-ci.org/onlime/laravel-sql-reporter.svg?branch=master)](https://travis-ci.org/onlime/laravel-sql-reporter)
4+
[![Build Status](https://github.com/onlime/laravel-sql-reporter/actions/workflows/ci.yml/badge.svg)](https://github.com/onlime/laravel-sql-reporter/actions/workflows/ci.yml)
55
[![Coverage Status](https://coveralls.io/repos/github/onlime/laravel-sql-reporter/badge.svg)](https://coveralls.io/github/onlime/laravel-sql-reporter)
6-
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/onlime/laravel-sql-reporter/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/onlime/laravel-sql-reporter/)
76

8-
This module allows you to log SQL queries (and slow SQL queries) to log file in Laravel framework. It's useful mainly
7+
This module allows you to log SQL queries to log file in Laravel framework. It's useful mainly
98
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.
109

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
11+
1112
## Installation
1213

1314
1. Run
@@ -26,7 +27,7 @@ when developing your application to verify whether your queries are valid and to
2627

2728
By default you should not edit published file because all the settings are loaded from `.env` file by default.
2829

29-
3. In your .env file add the following entries:
30+
3. In your `.env` file add the following entries:
3031

3132
```ini
3233
SQL_REPORTER_DIRECTORY="logs/sql"
@@ -42,15 +43,21 @@ when developing your application to verify whether your queries are valid and to
4243
SQL_REPORTER_FORMAT_ENTRY_FORMAT="-- Query [query_nr] [[query_time]]\\n[query]"
4344
```
4445

45-
and adjust values to your needs. You can skip variables for which you want to use default values.
46+
and adjust values to your needs. You can skip variables for which you want to use default values.
47+
48+
To only log DML / modifying queries like `INSERT`, `UPDATE`, `DELETE`, I recommend to use:
49+
50+
```ini
51+
SQL_REPORTER_QUERIES_PATTERN="/^(?!SELECT).*$/i"
52+
```
4653

47-
If you have also `.env.sample` it's also recommended to add those entries also in `.env.sample` file just to make sure everyone know about those env variables. Be aware that `SQL_REPORTER_DIRECTORY` is directory inside storage directory. If you want you can change it editing `config/sql-reporter.php` file.
54+
If you have also `.env.example` it's recommended to add those entries also in `.env.example` file just to make sure everyone knows about those env variables. Be aware that `SQL_REPORTER_DIRECTORY` is directory inside storage directory.
4855
4956
To find out more about those setting please take a look at [Configuration file](config/sql-reporter.php)
5057
5158
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)
5259

53-
5. Make sure on live server you will set logging SQL queries to false in your `.env` file. This package is recommended to be used only for development to not impact production application performance.
60+
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.
5461

5562
## Optional
5663

0 commit comments

Comments
 (0)