PHPackages                             kodus/sql-split - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. kodus/sql-split

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kodus/sql-split
===============

A simple facility to split SQL files into individual queries - supports MySQL and PostgreSQL

2.1.0(1y ago)6249.8k↓13.3%4[1 issues](https://github.com/kodus/sql-split/issues)1MITPHPPHP &gt;=8.0

Since Jun 9Pushed 1y ago3 watchersCompare

[ Source](https://github.com/kodus/sql-split)[ Packagist](https://packagist.org/packages/kodus/sql-split)[ RSS](/packages/kodus-sql-split/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (2)Versions (7)Used By (1)

`kodus/sql-split`
=================

[](#kodussql-split)

A simple parser to split SQL (and/or DDL) files into individual SQL queries and strip comments.

[![PHP Version](https://camo.githubusercontent.com/487804500a039aee09e5d93e41b745b4cd68dcc0fdf801e67d26d30b93f83358/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e302532422d626c75652e737667)](https://packagist.org/packages/kodus/sql-split)[![Build Status](https://camo.githubusercontent.com/1080750dfc3067c43d99265ecad3a8d6a86ab22803ca44f394f64ea2700cd240/68747470733a2f2f7472617669732d63692e6f72672f6b6f6475732f73716c2d73706c69742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/kodus/sql-split)

### Install via Composer

[](#install-via-composer)

```
composer require kodus/sql-split

```

### Features

[](#features)

I designed this for use with PDO and MySQL/PostgreSQL statements.

It uses a very simple recursive descent parser to minimally tokenize valid SQL - this approach ensures there is no ambiguity between quoted strings, keywords, comments, etc. but makes no attempt to validate SQL command structure or validity of the extracted statements.

It supports the following SQL/DDL features:

- SQL and DDL Queries
- Stored procedures, functions, views, triggers, etc.
- PostgreSQL dollar-tags (`$$` and `$mytag$` delimiters)
- The MySQL `DELIMITER` command

Usage
-----

[](#usage)

Just this:

```
$statements = Splitter::split(file_get_contents(...));
```

This will split to individual SQL statements and (by default) strip comments.

Then just loop over your `$statements` and run them via `PDO`.

That's all.

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community19

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% 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 ~554 days

Recently: every ~321 days

Total

6

Last Release

494d ago

Major Versions

1.0.3 → 2.0.02022-08-11

PHP version history (4 changes)1.0.0PHP ^7.0

1.0.1PHP ^7.0|^8.0

1.0.3PHP &gt;=7.4

2.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/ec1a54f85a6e46909df4ca4852ada0cc4b1482f7208dfc487d05554087e09cc9?d=identicon)[thomasnordahl-dk](/maintainers/thomasnordahl-dk)

![](https://www.gravatar.com/avatar/9d0432f9ee26cc6265bcf3817d88bf40a4a8669a603785b34946e9c15d7b3451?d=identicon)[boan-jfm](/maintainers/boan-jfm)

![](https://www.gravatar.com/avatar/22799a8c3c482e408f78fd86a999b271f1d5fd2e04b433c6d199f717b3032bb2?d=identicon)[JyskFynskeMedierJoej](/maintainers/JyskFynskeMedierJoej)

![](https://www.gravatar.com/avatar/a974d9ad4b2be14736394ce117f53f83e9186e9cc05002bc004678f0b0587e37?d=identicon)[mifich](/maintainers/mifich)

---

Top Contributors

[![thomasnordahl-dk](https://avatars.githubusercontent.com/u/5709900?v=4)](https://github.com/thomasnordahl-dk "thomasnordahl-dk (22 commits)")[![mindplay-dk](https://avatars.githubusercontent.com/u/103348?v=4)](https://github.com/mindplay-dk "mindplay-dk (10 commits)")[![mifich](https://avatars.githubusercontent.com/u/25659854?v=4)](https://github.com/mifich "mifich (1 commits)")

###  Code Quality

TestsCodeception

### Embed Badge

![Health badge](/badges/kodus-sql-split/health.svg)

```
[![Health](https://phpackages.com/badges/kodus-sql-split/health.svg)](https://phpackages.com/packages/kodus-sql-split)
```

###  Alternatives

[respect/config

A powerful, small, deadly simple configurator and dependency injection container made to be easy.

10211.4k1](/packages/respect-config)

PHPackages © 2026

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