A tool to standardize and improve your SQL strings.
SQL files are often created under time constraints, leading to inconsistencies and errors in their structure. Over time, these issues can become problematic, especially when stricter syntax is required due to changes in database management systems or as part of optimizing your codebase.
Having consistently well-structured SQL is important for maintaining a reliable and maintainable codebase. SqlNormalizer
aims to address this by providing a way to adapt and standardize SQL strings effectively.
SqlNormalizer
works by analyzing the SQL strings you provide and automatically adjusting them to meet modern SQL standards. The tool corrects syntax issues, applies consistent formatting, and ensures that your SQL code follows best practices.
This can be particularly useful when dealing with legacy SQL files or when ensuring that new queries are up to standard.
$ composer require corncodecreations/sql-normalizer
SqlNormalizer
provides static functions that is transforming the SQL string and returns a sanitized and normalized SQL string.
Example:
use CornCodeCreations\SqlNormalizer\Statement\AlterTable;
$sql = "...";
$sqlNormalized = AlterTable::addPrimaryKey_sanitizeColumnName($sql);
SqlNormalizer
is an open-source project in its early stages. Updates and improvements will be made as needed. As the tool develops, contributions from the community are welcome. Whether you have ideas for new features, improvements, or bug fixes, your help is appreciated.
We encourage collaboration and look forward to building a useful tool with the community's help.