PHPackages                             szonov/sql-splitter - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. szonov/sql-splitter

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

szonov/sql-splitter
===================

Library for parsing strings with multiple sql queries and split it to single queries

v2.0.0(3y ago)135.4k↓27.1%1MITPHPPHP &gt;=8.1.0

Since Dec 23Pushed 3y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

szonov/sql-splitter
===================

[](#szonovsql-splitter)

Library for parsing strings with multiple sql queries and split it to single queries

For now supported:

- Mysql (can be used for sqlite)
- Postgresql

Usage Example :: full (from string)
-----------------------------------

[](#usage-example--full-from-string)

```
include "vendor/autoload.php";

use SZonov\Text\Source\Text as Input;
use SZonov\SQL\Splitter\Postgresql as Parser;
use SZonov\Text\Parser\ParserIterator as Queries;

$sql = "CREATE TABLE a (id SERIAL PRIMARY KEY, val TEXT);"
     . "INSERT INTO a (val) VALUES ('myval');";
$input   = new Input($sql);
$parser  = new Parser($input);
$queries = new Queries($parser);

foreach ($queries as $query) {
    // make something useful with single query
    echo "[" . $query . "]\n";
}
```

Usage Example :: short (from file)
----------------------------------

[](#usage-example--short-from-file)

```
include "vendor/autoload.php";

use SZonov\SQL\Splitter\Postgresql as Parser;
use SZonov\Text\Parser\ParserIterator as Queries;

$queries = new Queries(Parser::fromFile('test.sql'));

foreach ($queries as $query) {
    // make something useful with single query
    echo "[" . $query . "]\n";
}
```

Usage Example :: V2+ syntax
---------------------------

[](#usage-example--v2-syntax)

```
include "vendor/autoload.php";

use SZonov\SQL\Splitter\Parser;

//$queries = Parser::fromFileUsingDriver('test.sql', 'mysql')->queries();
$queries = Parser::fromFileUsingDriver('test.sql', 'pgsql')->queries();

foreach ($queries as $query) {
    // make something useful with single query
    echo "[" . $query . "]\n";
}
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~1061 days

Total

3

Last Release

1312d ago

Major Versions

v1.0.1 → v2.0.02022-10-14

PHP version history (2 changes)v1.0.0PHP &gt;=5.3.1

v2.0.0PHP &gt;=8.1.0

### Community

Maintainers

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

---

Top Contributors

[![szonov](https://avatars.githubusercontent.com/u/13364789?v=4)](https://github.com/szonov "szonov (5 commits)")

### Embed Badge

![Health badge](/badges/szonov-sql-splitter/health.svg)

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

###  Alternatives

[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)[jms/serializer-bundle

Allows you to easily serialize, and deserialize data of any complexity

1.8k89.3M627](/packages/jms-serializer-bundle)[hassankhan/config

Lightweight configuration file loader that supports PHP, INI, XML, JSON, and YAML files

97513.5M170](/packages/hassankhan-config)[meyfa/php-svg

Read, edit, write, and render SVG files with PHP

54613.9M42](/packages/meyfa-php-svg)

PHPackages © 2026

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