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)7266.4k↓45.4%4[1 issues](https://github.com/kodus/sql-split/issues)1MITPHPPHP &gt;=8.0

Since Jun 9Pushed 1y ago2 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 2d 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 92% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community20

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

540d 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://avatars.githubusercontent.com/u/5709900?v=4)[Thomas Nordahl Pedersen](/maintainers/thomasnordahl-dk)[@thomasnordahl-dk](https://github.com/thomasnordahl-dk)

![](https://avatars.githubusercontent.com/u/13201214?v=4)[Bo Andersen](/maintainers/boan-jfm)[@boan-jfm](https://github.com/boan-jfm)

![](https://avatars.githubusercontent.com/u/32329468?v=4)[Jesper Østergaard Jensen](/maintainers/JyskFynskeMedierJoej)[@JyskFynskeMedierJoej](https://github.com/JyskFynskeMedierJoej)

![](https://avatars.githubusercontent.com/u/25659854?v=4)[Michelle Fich](/maintainers/mifich)[@mifich](https://github.com/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)
```

PHPackages © 2026

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