phpmyadmin/sql-parser
A validating SQL lexer and parser with a focus on MySQL dialect.
6.0.0
53M downloads/mo
#744 most downloaded on Packagist
phpmyadmin/sql-parser
What this package is like to depend on
Last release 9 months ago
31 Oct 2025
Ships fairly regularly
a new release about every 3 months
Nearly every release is documented
notes for 93 of 93 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
93 releases · first in 2015
1 release in the last 12 months
see the full history below
Release timeline
93 releases · Aug 2015 to Oct 2025
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Releases
latest 60 of 93-
6.0.031 Oct 2025Release notes
Open source →Added
- #550: Create the
StatementInfoclass - #549: Add
leftOperand,operatorandrightOperandproperties to theConditioncomponent
Changed
- Add native type declarations
- #365: Change
Componentabstract class to an interface - #368: Rename class members to use camel case format
- #384: Change
Context::load()error handling from throwing an exception to returning a boolean value - #454: Move
Misc::getAliases()intoSelectStatement::getAliases() - #480: Split up Context::escape()
- #470: Restrict parameter type of
OptionsArray::merge - #483: Split build into buildAll
- #505: Change some static properties into class constants
- #504: Change
TokensListclass to add thebuildFromArraymethod - #507: Replace the
Token::TYPE_*constants with theTokenTypeenum - #543: Extract
parsemethod from components into Parsers
Removed
Release notes
Open source →Added
- #550: Create the
StatementInfoclass - #549: Add
leftOperand,operatorandrightOperandproperties to theConditioncomponent
Changed
- Add native type declarations
- #365: Change
Componentabstract class to an interface - #368: Rename class members to use camel case format
- #384: Change
Context::load()error handling from throwing an exception to returning a boolean value - #454: Move
Misc::getAliases()intoSelectStatement::getAliases() - #480: Split up Context::escape()
- #470: Restrict parameter type of
OptionsArray::merge - #483: Split build into buildAll
- #505: Change some static properties into class constants
- #504: Change
TokensListclass to add thebuildFromArraymethod - #507: Replace the
Token::TYPE_*constants with theTokenTypeenum - #543: Extract
parsemethod from components into Parsers
Removed
- #550: Create the
-
5.11.120 Jul 2025Release notes
Open source →Added
- Add context files for MySQL 9.2, MySQL 9.3 and MariaDB 12.1 (#628)
- Add context files for MariaDB 11.8 and MariaDB 12.0 (#620)
Fixed
- Fix Window function handling that failed because of "OVER" keyword case-sensitive comparison (#623)
Release notes
Open source →Added
- Add context files for MySQL 9.2, MySQL 9.3 and MariaDB 12.1 (#628)
- Add context files for MariaDB 11.8 and MariaDB 12.0 (#620)
Fixed
- Fix Window function handling that failed because of "OVER" keyword case-sensitive comparison (#623)
-
5.11.022 Feb 2025Release notes
Open source →Added
- Add Translator::setLocale() method (#599)
Fixed
- Fix FORCE INDEX not been parsed correctly (#614)
- Fix parsing of ADD UNIQUE and ADD UNIQUE KEY for ALTER TABLE statements (#611)
-
5.10.319 Jan 2025Release notes
Open source →Fixed
- Add "RECURSIVE" on build() for "WITH RECURSIVE" on the WithStatement class (#605)
- Fix for quadratic complexity in certain queries, which could have caused long execution times. Thanks to Maximilian Krög (GitHub user MoonE) for this fix to help improve security.
-
5.10.205 Dec 2024Release notes
Open source →Release notes
Open source →Added
- Add MariaDb 11.6 and 11.7 contexts (#601)
- Add context files for MySQL 9.1 (#603)
-
5.10.110 Nov 2024Release notes
Open source →Fixed
- Fix parsing of ALTER TABLE … RENAME KEY (#580)
- Fix parsing table names that start with "e1" (#578)
- Improve handling of negative and overflowed offsets on TokensList (#582)
- Fix parsing of queries with 'AND' (#590)
- Fix C style comments with two asterisks (#597)
- Fix parsing of SRID in column definition (#595)
Release notes
Open source →Fixed
- Fix parsing of ALTER TABLE … RENAME KEY (#580)
- Fix parsing table names that start with "e1" (#578)
- Improve handling of negative and overflowed offsets on TokensList (#582)
- Fix parsing of queries with 'AND' (#590)
- Fix C style comments with two asterisks (#597)
- Fix parsing of SRID in column definition (#595)
-
5.10.029 Aug 2024Release notes
Open source →- Fix parsing of UPDATE ... SET (#577)
- Fix parsing of WITH PARSER (#563)
- Fix context files for MySQL and MariaDB (#572) (#576)
- Allow using
::classkeyword to load a context (#571) - Fix query flags for lower-case functions (#564)
- Improve context files by using constants (#570)
- Fix case when a condition is not parsed correctly (#560)
- Support parsing KILL statements (#556)
- Fix replace clause of select statement with FOR UPDATE (#555)
- Add support for ALTER FUNCTION and ALTER PROCEDURE statements (#553)
Release notes
Open source →- Fix parsing of UPDATE ... SET (#577)
- Fix parsing of WITH PARSER (#563)
- Fix context files for MySQL and MariaDB (#572) (#576)
- Allow using
::classkeyword to load a context (#571) - Fix query flags for lower-case functions (#564)
- Improve context files by using constants (#570)
- Fix case when a condition is not parsed correctly (#560)
- Support parsing KILL statements (#556)
- Fix replace clause of select statement with FOR UPDATE (#555)
- Add support for ALTER FUNCTION and ALTER PROCEDURE statements (#553)
-
5.9.113 Aug 2024Release notes
Open source →- Allow parsing ALTER TABLE statement with column check constraint (#554)
- Add support for PHPUnit 10 (#573)
-
5.9.020 Jan 2024Release notes
Open source →- Fix keywords not being recognized as table alias (#496)
- Add
bin/sql-parserexecutable file (#517) - Fix bind parameter in LIMIT OFFSET (#498)
- Fix using ? as a parameter (#515)
-
5.8.219 Sep 2023 -
5.8.115 Sep 2023Release notes
Open source →- Fix
:=was not recognized as an operator just like=(#306) - Fix
ALTER TABLE … MODIFY … ENUM('<reserved_keyword>')is being wrongly parsed (#234) - Fix
ALTER TABLE … MODIFY … ENUM('<reserved_keyword>')is being wrongly parsed (#478) - Fix MariaDB window function with alias gives bad linting errors (#283)
- Fix unrecognized keyword
COLLATEinWHEREclauses (#491) - Fix invalid hexadecimal prefix 0X (#508)
- Fix
-
5.8.005 Jun 2023Release notes
Open source →- Fix
ALTER EVENT RENAME TOto use expression instead of var (#419) - Fix incorrect order of operations to parse table/db called `` (#422)
- Fix ALTER EVENT statement with DEFINER=user modifier fails to be parsed (#418)
- Fix GROUP BY modifier WITH ROLLUP is treated as a syntax error and prevents export of SQL query results
- Fix
TokensList::getPreviouswas not able to reach very first token (#428) - Fix
TransactionStatement::build()"Call to a member function build() on null" when the transaction has no end - Fix MySQL-specific commands parsing (#226)
- Fix
ALTER TABLE … RENAME COLUMN … TO …is not understood by the parser/linter (#430) - Fix
PARTITIONsyntax errors (#377) - Fix
ALTER USERwhen used withIDENTIFIED WITH/VIA/BYoption (#431) - Fix
COALESCE PARTITIONinALTER TABLE, rather thanCOALESCE(#323) - Support
ALGORITHMandLOCKoptions inALTER TABLEstatements (#319) - Fix way end of functions, procedures and triggers' bodies is identified (#438)
- Fix
enclosed byis not recognized by the parser whenfieldsis in lower case (#236) - Support
KEYonCreateDefinition(#330) - Fix
CALLstatements parsing (#372) - Implement support for
LEFT JOIN,JOIN,INNER JOINonUpdateStatement(#260) - Implement support for
TABLEandREPLACEstatements onDESCRIBEstatements - Fix
DESCRIBEto allow a schema.table syntax (#445) - Fix parsing insert queries with functions trims commas (#450)
- Fix
-
5.7.025 Jan 2023Release notes
Open source →- Performance improvement to use less the
nextToken()function (#397) - Lexer - Solving ambiguity on function keywords (#385)
- Implement
ALTER EVENT(#404) - Add
ALTER EVENTkeywords (#404) - Drop PHP 7.1 support
- Fix the alter operation table options
RENAME INDEX x TO y(#405) - Fix
CreateStatementfunction's options (#406) - Fix a PHP notice on Linter using
ANALYZE(#413)
- Performance improvement to use less the
-
5.6.002 Jan 2023Release notes
Open source →- Add missing return types annotations
- Improve the WITH statements parser (#363)
- Add support for passing
Context::SQL_MODE*constants toContext::setModemethod - Fix additional body tokens issue with
CREATE VIEWstatements (#371) - Exclude from composer vendor bundle /tests and /phpunit.xml.dist
- Support table structure with
COMPRESSEDcolumns (#351) - Add
#[\AllowDynamicProperties]onStatementandExpressionclasses for PHP 8.2 support - Support
ALTERqueries ofPARTITIONS(#329) - Change
Context::load()error handling to returning a boolean value instead of throwing aLoaderException(#384) - Fixed differentiating between
ANALYZEandEXPLAINstatements (#386) - Added "NOT" to the select options (#374)
- Implement the
EXPLAINParser (#389) - Context: Updated contexts to contain
multipointandmultipolygondata types (#393) - Support more keywords on
Expressioncomponent (#399) - Fix PHP 8.3 failing tests (#400)
-
5.5.009 Dec 2021Release notes
Open source →- Add WITH support (#165, #331)
- Fixed BufferedQuery when it has an odd number of backslashes in the end (#340)
- Fixed the issue that ignored the body tokens when creating views with union (#343)
- Fixed parser errors on "ALTER TABLE" statements to add columns with SET type (#168)
- Fixed PHP 8.1 fatal errors on classes that "implements ArrayAccess"
- Add new contexts for MariaDB 10.4, 10.5, 10.6 (#328)
- Fixed parser errors for "ALTER USER" with options (#342)
- Fixed handling of the procedures and functions's options where part of the body (#339)
- Fix PHP notice "Undefined index: name in src/Components/Key.php#206" for table keys using expressions (#347)
- Added support for MySQL 8.0 table structure KEY expressions (#347)
- Added support for KEY order (ASC/DESC) (#296)
- Added missing KEY options for MySQL and MariaDB (#348)
- Added support for ENFORCED and NOT ENFORCED on table create queries (#341)
- Performance improvement to use less the "ord()" function (#352)
- Added support for OVER() with an alias (AS) (#197)
-
5.4.205 Feb 2021Release notes
Open source →- Added check for quoted symbol to avoid parser error in case of keyword (#317)
- Allow PHP 8
-
5.4.115 Oct 2020Release notes
Open source →- Fix array_key_exists warning when parsing a "DEFAULT FALSE" token (#299)
-
5.4.008 Oct 2020Release notes
Open source →- EXISTS is also a function. (#297)
- Fix lexer to not allow numbers with letters (#300)
- Add support for INVISIBLE keyword (#292)
- Fix the "$" might be a character used in a name (#301)
- Fix use stream_select instead of non-blocking STDIN (#309)
- Add select validation to a create view statement (#310)
-
5.3.121 Mar 2020Release notes
Open source →- Revert some changes with the understanding of ANSI_QUOTES mode and identifiers
- Suggest motranslator 5.0 in README
-
5.3.020 Mar 2020Release notes
Open source →- Stop instanciating an object to check its class name. (#290)
- Replace sscanf by equivalent native PHP functions because sscanf can be disabled for security reasons. (#270)
- Allow phpunit 9
- Allow phpmyadmin/motranslator 5.0
- Fix for php error when "INSERT INTO x SET a = 1" is "INSERT INTO x SET = 1" (#295)
- Fixed lexer fails to detect "*" as a wildcard (#288)
- Fixed ANSI_QUOTES support (#284)
- Fixed parser mistakes with comments (#156)
-
5.2.007 Jan 2020Release notes
Open source →- Fix ALTER TABLE ... PRIMARY/UNIQUE KEY results in error (#267)
- Prevent overwrite of offset in Limit clause by parenthesis (#275)
- Allow SCHEMA to be used in CREATE Database statement (#231)
- Add missing options in SET statement (#255)
- Add support for DROP USER statement (#259)
- Fix php error "undefined index" when replacing a non existing clause (#249)
-
5.1.012 Nov 2019Release notes
Open source →- Fix for PHP deprecations messages about implode for php 7.4+ (#258)
- Parse CHECK keyword on table definition (#264)
- Parse truncate statement (#221)
- Fix wrong parsing of partitions (#265)
-
5.0.010 May 2019Release notes
Open source →- Drop support for PHP 5.3, PHP 5.4, PHP 5.5, PHP 5.6, PHP 7.0 and HHVM
- Enable strict mode on PHP files
- Fix redundant whitespaces in build() outputs (#228)
- Fix incorrect error on DEFAULT keyword in ALTER operation (#229)
- Fix incorrect outputs from Query::getClause (#233)
- Add support for reading an SQL file from stdin
- Fix for missing tokenize-query in Composer's vendor/bin/ directory
- Fix for PHP warnings with an incomplete CASE expression (#241)
- Fix for error message with multiple CALL statements (#223)
- Recognize the question mark character as a parameter (#242)
-
4.7.309 Dec 2021Release notes
Open source →- Fixed BufferedQuery when it has an odd number of backslashes in the end (#340)
- Fixed the issue that ignored the body tokens when creating views with union (#343)
- Fixed parser errors on "ALTER TABLE" statements to add columns with SET type (#168)
- Fixed parser errors for "ALTER USER" with options (#342)
- Fixed handling of the procedures and functions's options where part of the body (#339)
- Fix PHP notice "Undefined index: name in src/Components/Key.php#206" for table keys using functions (#347)
- Fix MySQL 8.0 table structure KEY expression not recognized (#347)
- Fix KEY order (ASC/DESC) not part of the KEY definition (#296)
- Fix missing KEY options for MySQL and MariaDB (#348)
- Fix validation error when using ENFORCED option (#341)
-
4.7.205 Feb 2021Release notes
Open source →- Added check for quoted symbol to avoid parser error in case of keyword (#317)
- Adjust PHP version constraint to not support PHP 8.0 on the 4.7 series (5.x series supports it)
-
4.7.115 Oct 2020Release notes
Open source →- Fix array_key_exists warning when parsing a "DEFAULT FALSE" token (#299)
-
4.7.008 Oct 2020Release notes
Open source →- EXISTS is also a function. (#297)
- Fix lexer to not allow numbers with letters (#300)
- Add support for INVISIBLE keyword (#292)
- Fix the "$" might be a character used in a name (#301)
- Fix use stream_select instead of non-blocking STDIN (#309)
- Add select validation to a create view statement (#310)
-
4.6.121 Mar 2020Release notes
Open source →- Revert some changes with the understanding of ANSI_QUOTES mode and identifiers
- Suggest motranslator 4.0 in README
-
4.6.020 Mar 2020Release notes
Open source →- Stop instanciating an object to check its class name. (#290)
- Replace sscanf by equivalent native PHP functions because sscanf can be disabled for security reasons. (#270)
- Allow phpunit 7
- Fix for php error when "INSERT INTO x SET a = 1" is "INSERT INTO x SET = 1" (#295)
- Fixed lexer fails to detect "*" as a wildcard (#288)
- Fixed ANSI_QUOTES support (#284)
- Fixed parser mistakes with comments (#156)
-
4.5.007 Jan 2020Release notes
Open source →- Fix ALTER TABLE ... PRIMARY/UNIQUE KEY results in error (#267)
- Prevent overwrite of offset in Limit clause by parenthesis (#275)
- Allow SCHEMA to be used in CREATE Database statement (#231)
- Add missing options in SET statement (#255)
- Add support for DROP USER statement (#259)
- Fix php error "undefined index" when replacing a non existing clause (#249)
-
4.4.012 Nov 2019Release notes
Open source →- Fix for PHP deprecations messages about implode for php 7.4+ (#258)
- Parse CHECK keyword on table definition (#264)
- Parse truncate statement (#221)
- Fix wrong parsing of partitions (#265)
-
4.3.203 Jun 2019Release notes
Open source →Backport fixes from 5.0.0 to QA branch:
- Fix redundant whitespaces in build() outputs (#228)
- Fix incorrect error on DEFAULT keyword in ALTER operation (#229)
- Fix incorrect outputs from Query::getClause (#233)
- Add support for reading an SQL file from stdin
- Fix for missing tokenize-query in Composer's vendor/bin/ directory
- Fix for PHP warnings with an incomplete CASE expression (#241)
- Fix for error message with multiple CALL statements (#223)
- Recognize the question mark character as a parameter (#242)
-
v4.3.105 Jan 2019Release notes
Open source →- Fixed incorrect error thrown on DEFAULT keyword in ALTER statement (#218)
-
v4.3.025 Dec 2018Release notes
Open source →- Add support for aliases on CASE expressions (#162 and #192)
- Add support for INDEX hints in SELECT statement (#199)
- Add support for LOCK and UNLOCK TABLES statement (#180)
- Add detection of extraneous comma in UPDATE statement (#160)
- Add detection of a missing comma between two ALTER operations (#189)
- Add missing support for STRAIGHT_JOIN (#196)
- Add support for end options in SET statement (#190)
- Fix building of RENAME statements (#201)
- Add support for PURGE statements (#207)
- Add support for COLLATE keyword (#190)
-
v4.2.531 Oct 2018 -
v4.2.406 Dec 2017Release notes
Open source →- Fix parsing of CREATE TABLE with per field COLLATE.
- Improved Context::loadClosest to better deal with corner cases.
- Localization updates.
-
v4.2.310 Oct 2017Release notes
Open source →- Make mbstring extension optional (though Symfony polyfill).
- Fixed build CREATE TABLE query with PARTITIONS having ENGINE but not VALUES.
-
v4.2.228 Sep 2017 -
v4.2.108 Sep 2017 -
v4.2.030 Aug 2017Release notes
Open source →- Initial support for MariaDB SQL contexts.
- Add support for MariaDB 10.3 INTERSECT and EXCEPT.
-
v4.1.1021 Aug 2017 -
v4.1.912 Jul 2017Release notes
Open source →- Various code cleanups.
- Improved error handling of several invalid statements.
-
v4.1.809 Jul 2017Release notes
Open source →- Fixed parsing SQL comment at the end of query.
- Improved handing of non utf-8 strings.
- Added query flag for SET queries.
-
v4.1.706 Jun 2017 -
v4.1.601 Jun 2017 -
v4.1.515 May 2017Release notes
Open source →- Fixed invalid lexing of queries with : in strings.
- Properly handle maximal length of delimiter.
-
v4.1.405 May 2017Release notes
Open source →- Fixed wrong extract of string tokens with escaped characters.
- Properly handle lowercase begin statement.
-
v4.1.306 Apr 2017Release notes
Open source →- Added support for DELETE ... JOIN clauses.
- Changed BufferedQuery to include comments in output.
- Fixed parsing of inline comments.
-
v4.1.220 Feb 2017Release notes
Open source →- Coding style improvements.
- Chinese localization.
- Improved order validatin for JOIN clauses.
- Improved pretty printing of JOIN clauses.
- Added support for LOAD DATA statements.
-
v4.1.107 Feb 2017Release notes
Open source →- Localization using phpmyadmin/motranslator is now optional.
- Improved testsuite.
- Better handling of non upper cased not reserved keywords.
- Minor performance and coding style improvements.
-
v4.1.023 Jan 2017 -
v4.0.123 Jan 2017 -
v4.0.023 Jan 2017 -
v3.4.1720 Jan 2017Release notes
Open source →- Coding style fixes.
- Fixed indentation in HTML formatting.
- Fixed parsing of unterminated variables.
- Improved comments lexing.
-
v3.4.1606 Jan 2017Release notes
Open source →- Coding style fixes.
- Properly handle operators AND, NOT, OR, XOR, DIV, MOD
-
v3.4.1502 Jan 2017Release notes
Open source →- Fix return value of Formatter.toString() when type is text
- Fix parsing of FIELDS and LINES options in SELECT..INTO
- PHP 7.2 compatibility.
- Better parameter passing to query formatter.
-
v3.4.1430 Nov 2016 -
v3.4.1315 Nov 2016Release notes
Open source →- Fix broken incorrect clause order detection for Joins.
- Add parsing of end options in Select statements.
-
v3.4.1209 Nov 2016 -
v3.4.1125 Oct 2016Release notes
Open source →- Fixed parsing of ON UPDATE option in field definition of TIMESTAMP type with precision
- Fixed parsing of NATURAL JOIN, CROSS JOIN and related joins.
- Fixed parsing of BEGIN/END labels.