{"id":17274521,"url":"https://github.com/cweiske/php-sqllint","last_synced_at":"2025-10-08T02:57:26.915Z","repository":{"id":66261034,"uuid":"47715821","full_name":"cweiske/php-sqllint","owner":"cweiske","description":"Command line tool to validate (syntax check) SQL files. Mirror of http://git.cweiske.de/php-sqllint.git/","archived":false,"fork":false,"pushed_at":"2020-08-15T07:42:42.000Z","size":44,"stargazers_count":47,"open_issues_count":1,"forks_count":5,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-08-08T07:32:02.450Z","etag":null,"topics":["linter","sql","validator"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cweiske.png","metadata":{"files":{"readme":"README.rst","changelog":"ChangeLog","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-12-09T20:06:29.000Z","updated_at":"2025-05-16T06:41:14.000Z","dependencies_parsed_at":"2023-03-13T20:30:16.515Z","dependency_job_id":null,"html_url":"https://github.com/cweiske/php-sqllint","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/cweiske/php-sqllint","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cweiske%2Fphp-sqllint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cweiske%2Fphp-sqllint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cweiske%2Fphp-sqllint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cweiske%2Fphp-sqllint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cweiske","download_url":"https://codeload.github.com/cweiske/php-sqllint/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cweiske%2Fphp-sqllint/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278881830,"owners_count":26062176,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["linter","sql","validator"],"created_at":"2024-10-15T08:54:08.933Z","updated_at":"2025-10-08T02:57:26.869Z","avatar_url":"https://github.com/cweiske.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"***********\nPHP-SQLlint\n***********\n\nCommand line tool to validate (syntax check) SQL files.\nPrimarily for MySQL ``.sql`` files.\n\nCan be used in git pre-commit hooks to catch errors.\nUse it from your shell, offline and without any SQL server.\n\nYou can also use it to format SQL queries.\n\n\n=====\nUsage\n=====\nSyntax check::\n\n    $ php-sqllint tests/files/create-missingcomma.sql \n    Checking SQL syntax of tests/files/create-missingcomma.sql\n     Line 3, col 5 at \"pid\": A comma or a closing bracket was expected.\n     Line 3, col 13 at \"11\": Unexpected beginning of statement.\n     Line 3, col 17 at \"DEFAULT\": Unrecognized statement type.\n\nEmacs mode::\n\n    $ php-sqllint -r emacs tests/files/create-noname.sql \n    tests/files/create-noname.sql:1.12:Error: The name of the entity was expected.\n    tests/files/create-noname.sql:1.13:Error: A closing bracket was expected.\n    tests/files/create-noname.sql:1.13:Error: At least one column definition was expected.\n\n\nFormatting::\n\n    $ php-sqllint --format tests/files/select-unformatted.sql\n    SELECT\n      id,\n      NAME,\n      url\n    FROM\n      users\n    WHERE\n      DATE \u003e NOW() AND id != 0\n    ORDER BY NAME\n    LIMIT 10\n\n\nSyntax highlighting\n===================\nANSI colors are applied automatically when not piping; you can use the\n``--highlight`` option to override the automatism.\n\n``--highlight`` option values:\n\n``none``\n  No highlighting. Use it to disable automatic highlighting\n``ansi``\n  ANSI escape codes for your shell\n``html``\n  HTML tags\n\n\n====\nBugs\n====\nDoes ``php-sqllint`` not detect a syntax error, or doesn't support a certain\nSQL statement?\nThen please report a bug at `phpmyadmin/sql-parser`__.\n\n__ https://github.com/phpmyadmin/sql-parser\n\n\n======================\nInstall using composer\n======================\nRun ``composer require cweiske/php-sqllint``, the package is hosted on `packagist \u003chttps://packagist.org/packages/cweiske/php-sqllint\u003e`__\n\n\n========\nDownload\n========\nThe download files are equipped with all dependencies.\nJust download and run.\n\n.. LATESTRELEASE\n\nSee `php-sqllint downloads page \u003chttp://cweiske.de/php-sqllint-download.htm\u003e`_\nfor all released versions.\n\n\n============\nDependencies\n============\n- PEAR's `Console_Commandline`__\n- `phpMyAdmin's SqlParser`__\n\n__ http://pear.php.net/package/Console_CommandLine\n__ https://github.com/phpmyadmin/sql-parser\n\n\nDependency installation\n=======================\n::\n\n    $ composer install\n\nNow you can use ``./bin/php-sqllint`` without building the phar yourself.\n\n\n========\nBuilding\n========\n\nPreparation\n===========\n1. Write new version number into ``VERSION``\n\n\nCreate the release\n==================\nYou'll need `phing`__, the PHP build tool::\n\n    $ phing\n\n__ https://www.phing.info/\n\nThe result are ``.phar`` files in ``dist/`` directory that you can execute::\n\n    $ ./dist/php-sqllint-0.0.1.phar tests/files/create-noname.sql \n    Checking SQL syntax of tests/files/create-noname.sql\n     Line 1, col 12 at \"(\": The name of the entity was expected.\n\n\n=================\nAbout PHP-SQLlint\n=================\n\nLicense\n=======\n``php-sqllint`` is licensed under the `AGPL v3`__ or later.\n\n__ http://www.gnu.org/licenses/agpl.html\n\n\nHomepage\n========\nHome page\n   http://cweiske.de/php-sqllint.htm\nSource code\n   http://git.cweiske.de/php-sqllint.git\n\n   Mirror: https://github.com/cweiske/php-sqllint\n\n\nAuthor\n======\nWritten by `Christian Weiske`__, cweiske+php-sqllint@cweiske.de\n\n__ http://cweiske.de/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcweiske%2Fphp-sqllint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcweiske%2Fphp-sqllint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcweiske%2Fphp-sqllint/lists"}