davidlienhard / database-query-validator
🐘 php tool to validate database queries
Installs: 6 056
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 1
Requires
- php: ^8.0
- league/flysystem: ^3
- nikic/php-parser: ^4
- phpmyadmin/sql-parser: ^5
- symfony/filesystem: ^6
- symfony/yaml: ^6
- webmozart/glob: ^4
Requires (Dev)
This package is auto-updated.
Last update: 2024-11-05 08:51:10 UTC
README
🐘 php tool to validate database queries written using davidlienhard/database
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 scansdumpfile
(string
): path to a mysql dump file to use for type-checksparameters
(object
):ignoresyntax
(bool
): whether or not to ignore syntax-errors in the queriesstrictinserts
(bool
): checks if inserts contains all text-colums of table that are set to not nullstrictinsertsignoremissingtablenames
(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
{ "paths": [ "src" ], "exclusions": [ "**/exclude.php" ], "dumpfile": "dump.sql", "parameters": { "ignoresyntax": false, "strictinserts": false } }
YAML
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 for more information.