https://github.com/davidlienhard/database-query-validator
🐘 php tool to validate database queries written using davidlienhard/database
https://github.com/davidlienhard/database-query-validator
database library mysql php
Last synced: 4 months ago
JSON representation
🐘 php tool to validate database queries written using davidlienhard/database
- Host: GitHub
- URL: https://github.com/davidlienhard/database-query-validator
- Owner: davidlienhard
- License: mit
- Created: 2021-04-06T07:55:22.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2025-12-13T08:01:38.000Z (7 months ago)
- Last Synced: 2025-12-14T22:12:50.399Z (7 months ago)
- Topics: database, library, mysql, php
- Language: PHP
- Homepage:
- Size: 311 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# davidlienhard/database-query-validator
🐘 php tool to validate database queries written using [`davidlienhard/database`](https://github.com/davidlienhard/database)
[](https://packagist.org/packages/davidlienhard/database-query-validator)
[](https://github.com/davidlienhard/database-query-validator)
[](https://github.com/davidlienhard/database-query-validator/blob/master/LICENSE)
[](https://php.net/)
[](https://github.com/davidlienhard/database-query-validator/actions/workflows/check.yml)
## Configuration
This tool requires a file named `query-validator.json` in your main project directory. CLI arguments are not supported at the moment.
The following configuration options are possible:
- **`paths`** (`array`): list of paths (folders or files) to scan.
- **`exclusions`** (`array`): list of paths to exclude from the scans
- **`dumpfile`** (`string`): path to a mysql dump file to use for type-checks
- **`parameters`** (`object`):
- `ignoresyntax` (`bool`): whether or not to ignore syntax-errors in the queries
- `strictinserts` (`bool`): checks if inserts contains all text-colums of table that are set to not null
- `strictinsertsignoremissingtablenames` (`bool`): whether to ignore queries where the tablename could not be extracted on strict imports
All paths are relative to the path of the configuration file. If no configuration file can be found all the files in your currect folder will be scanned.
### Example Configuration-File
#### JSON
```json
{
"paths": [
"src"
],
"exclusions": [
"**/exclude.php"
],
"dumpfile": "dump.sql",
"parameters": {
"ignoresyntax": false,
"strictinserts": false
}
}
```
#### YAML
```yml
paths:
- src
exclusions:
- "**/exclude.php"
dumpfile: dump.sql
parameters:
ignoresyntax: false
strictinserts: false
```
## Todo
This project is still work in progress and there is a lot of work todo.
- improve validation of queries
- improve documentation (of course)
- add unit tests
- improve recognition of database-queries
- improve config
- add support of CLI arguments
## License
The MIT License (MIT). Please see [LICENSE](https://github.com/davidlienhard/httpclient/blob/master/LICENSE) for more information.