PHPackages                             processfast/php-sql-parser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. processfast/php-sql-parser

ActiveLibrary[Database &amp; ORM](/categories/database)

processfast/php-sql-parser
==========================

A fork of greenlion/php-sql-parser made because we were having trouble getting a production needed fix accepted and merged into their repo. A pure PHP SQL (non validating) parser w/ focus on MySQL dialect of SQL

4.1.4(6y ago)18.3kBSD-3-ClausePHPPHP &gt;=5.3.2

Since Apr 12Pushed 6y ago2 watchersCompare

[ Source](https://github.com/ProcessFast/PHP-SQL-Parser)[ Packagist](https://packagist.org/packages/processfast/php-sql-parser)[ Docs](https://github.com/ProcessFast/PHP-SQL-Parser)[ RSS](/packages/processfast-php-sql-parser/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (3)Versions (9)Used By (0)

PHP-SQL-Parser
==============

[](#php-sql-parser)

A pure PHP SQL (non validating) parser w/ focus on MySQL dialect of SQL

### Download

[](#download)

[GitHub Wiki](https://github.com/greenlion/PHP-SQL-Parser/wiki/Downloads)

### Full support for the MySQL dialect for the following statement types

[](#full-support-for-the-mysql-dialect-for-the-following-statement-types)

```
SELECT
INSERT
UPDATE
DELETE
REPLACE
RENAME
SHOW
SET
DROP
CREATE INDEX
CREATE TABLE
EXPLAIN
DESCRIBE

```

### Other SQL statement types

[](#other-sql-statement-types)

Other statements are returned as an array of tokens. This is not as structured as the information available about the above types. See the [ParserManual](https://github.com/greenlion/PHP-SQL-Parser/wiki/Parser-Manual) for more information.

### Other SQL dialects

[](#other-sql-dialects)

Since the MySQL SQL dialect is very close to SQL-92, this should work for most database applications that need a SQL parser. If using another database dialect, then you may want to change the reserved words - see the [ParserManual](https://github.com/greenlion/PHP-SQL-Parser/wiki/Parser-Manual). It supports UNION, subqueries and compound statements.

### External dependencies

[](#external-dependencies)

The parser is a self contained class. It has no external dependencies. The parser uses a small amount of regex.

### Focus

[](#focus)

The focus of the parser is complete and accurate support for the MySQL SQL dialect. The focus is not on optimizing for performance. It is expected that you will present syntactically valid queries.

### Manual

[](#manual)

[ParserManual](https://github.com/greenlion/PHP-SQL-Parser/wiki/Parser-Manual) - Check out the manual.

### Example Output

[](#example-output)

**Example Query**

```
SELECT STRAIGHT_JOIN a, b, c
  FROM some_table an_alias
 WHERE d > 5;
```

**Example Output (via print\_r)**

```
Array
(
    [OPTIONS] => Array
        (
            [0] => STRAIGHT_JOIN
        )

    [SELECT] => Array
        (
            [0] => Array
                (
                    [expr_type] => colref
                    [base_expr] => a
                    [sub_tree] =>
                    [alias] => `a`
                )

            [1] => Array
                (
                    [expr_type] => colref
                    [base_expr] => b
                    [sub_tree] =>
                    [alias] => `b`
                )

            [2] => Array
                (
                    [expr_type] => colref
                    [base_expr] => c
                    [sub_tree] =>
                    [alias] => `c`
                )

        )

    [FROM] => Array
        (
            [0] => Array
                (
                    [table] => some_table
                    [alias] => an_alias
                    [join_type] => JOIN
                    [ref_type] =>
                    [ref_clause] =>
                    [base_expr] =>
                    [sub_tree] =>
                )

        )

    [WHERE] => Array
        (
            [0] => Array
                (
                    [expr_type] => colref
                    [base_expr] => d
                    [sub_tree] =>
                )

            [1] => Array
                (
                    [expr_type] => operator
                    [base_expr] => >
                    [sub_tree] =>
                )

            [2] => Array
                (
                    [expr_type] => const
                    [base_expr] => 5
                    [sub_tree] =>
                )

        )

)
```

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 93.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~381 days

Recently: every ~272 days

Total

6

Last Release

2554d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1058532?v=4)[Brad Stancel](/maintainers/stancel)[@stancel](https://github.com/stancel)

---

Top Contributors

[![witchi](https://avatars.githubusercontent.com/u/5766508?v=4)](https://github.com/witchi "witchi (2331 commits)")[![greenlion](https://avatars.githubusercontent.com/u/465334?v=4)](https://github.com/greenlion "greenlion (95 commits)")[![donatj](https://avatars.githubusercontent.com/u/133747?v=4)](https://github.com/donatj "donatj (19 commits)")[![polevaultweb](https://avatars.githubusercontent.com/u/1770201?v=4)](https://github.com/polevaultweb "polevaultweb (12 commits)")[![dbould](https://avatars.githubusercontent.com/u/5477476?v=4)](https://github.com/dbould "dbould (12 commits)")[![yfix](https://avatars.githubusercontent.com/u/659419?v=4)](https://github.com/yfix "yfix (6 commits)")[![PSF1](https://avatars.githubusercontent.com/u/10193279?v=4)](https://github.com/PSF1 "PSF1 (5 commits)")[![oohook](https://avatars.githubusercontent.com/u/4328913?v=4)](https://github.com/oohook "oohook (4 commits)")[![jaiminmoslake7020](https://avatars.githubusercontent.com/u/4865636?v=4)](https://github.com/jaiminmoslake7020 "jaiminmoslake7020 (2 commits)")[![gluneaumt](https://avatars.githubusercontent.com/u/12433326?v=4)](https://github.com/gluneaumt "gluneaumt (2 commits)")[![oscar3x39](https://avatars.githubusercontent.com/u/3096182?v=4)](https://github.com/oscar3x39 "oscar3x39 (1 commits)")[![greggunner](https://avatars.githubusercontent.com/u/909758?v=4)](https://github.com/greggunner "greggunner (1 commits)")[![moufmouf](https://avatars.githubusercontent.com/u/1290952?v=4)](https://github.com/moufmouf "moufmouf (1 commits)")[![bryant1410](https://avatars.githubusercontent.com/u/3905501?v=4)](https://github.com/bryant1410 "bryant1410 (1 commits)")[![Seldaek](https://avatars.githubusercontent.com/u/183678?v=4)](https://github.com/Seldaek "Seldaek (1 commits)")[![sk-sparhandy](https://avatars.githubusercontent.com/u/7532845?v=4)](https://github.com/sk-sparhandy "sk-sparhandy (1 commits)")[![stancel](https://avatars.githubusercontent.com/u/1058532?v=4)](https://github.com/stancel "stancel (1 commits)")[![xRahul](https://avatars.githubusercontent.com/u/1639945?v=4)](https://github.com/xRahul "xRahul (1 commits)")

---

Tags

parsermysqlsqlcreator

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/processfast-php-sql-parser/health.svg)

```
[![Health](https://phpackages.com/badges/processfast-php-sql-parser/health.svg)](https://phpackages.com/packages/processfast-php-sql-parser)
```

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k605.0M6.7k](/packages/doctrine-dbal)[greenlion/php-sql-parser

A pure PHP SQL (non validating) parser w/ focus on MySQL dialect of SQL

64112.4M97](/packages/greenlion-php-sql-parser)[catfan/medoo

The lightweight PHP database framework to accelerate development

5.0k1.6M203](/packages/catfan-medoo)[phpmyadmin/sql-parser

A validating SQL lexer and parser with a focus on MySQL dialect.

48252.2M72](/packages/phpmyadmin-sql-parser)[ifsnop/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k6.0M76](/packages/ifsnop-mysqldump-php)[cycle/orm

PHP DataMapper ORM and Data Modelling Engine

1.3k888.3k77](/packages/cycle-orm)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
