PHPackages                             y0lk/sqldumper - 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. y0lk/sqldumper

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

y0lk/sqldumper
==============

SQL dump utility

0.2.2(2y ago)32.1k2MITPHPPHP &gt;=7.2.0CI failing

Since Nov 18Pushed 2y ago2 watchersCompare

[ Source](https://github.com/Y0lk/sqldumper)[ Packagist](https://packagist.org/packages/y0lk/sqldumper)[ RSS](/packages/y0lk-sqldumper/feed)WikiDiscussions master Synced 3w ago

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

SQLDumper
=========

[](#sqldumper)

[![Latest Stable Version](https://camo.githubusercontent.com/22ac7d2872994f81e1dd1c1981ec20278c6f1c668d2b84c8fa7ea0142de87c5b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f79306c6b2f73716c64756d7065722e737667)](https://packagist.org/packages/y0lk/sqldumper)[![Build Status](https://camo.githubusercontent.com/741ab9e854da015baa6eb9aac90ebd8994d172f815c2189565d46a1265813375/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f59306c6b2f73716c64756d7065722e737667)](https://travis-ci.org/Y0lk/sqldumper)[![Code Coverage](https://camo.githubusercontent.com/36d8f28acf8c743e4e50d5fcefbf6b197d0ce724ea9953744c09a3be61986026/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f59306c6b2f73716c64756d7065722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Y0lk/sqldumper/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/cbb04f8b8d71f2a6468b3e6409c745b34b14bf0737a3c1bd7aea321a43a83f58/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f59306c6b2f73716c64756d7065722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Y0lk/sqldumper/?branch=master)[![License](https://camo.githubusercontent.com/aca46d12582a9d7a5744773530be6a717667c4a6a4c482869697b3730b51b3a4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f79306c6b2f73716c64756d7065722e737667)](https://github.com/y0lk/sqldumper/blob/master/LICENSE)[![Total Downloads](https://camo.githubusercontent.com/1be8945ecf9b2441d2c55cfdf4fbbf26f77fd664fff3b32f990884dd67e12fb0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f79306c6b2f73716c64756d7065722e7376673f6d61784167653d32353932303030)](https://packagist.org/packages/y0lk/sqldumper)

SQLDumper is a small library designed to easily create customized SQL dumps.

Installation
------------

[](#installation)

Via Composer

```
$ composer require y0lk/sqldumper
```

Usage
-----

[](#usage)

The concept is that you can select tables and set certain "dump parameters" for each table, made so you can chain a bunch of calls to quickly create a customized dump.

```
use Y0lk\SQLDumper\SQLDumper;

//Init the dumper with your DB info
$dumper = new SQLDumper('localhost', 'dbname', 'root', '');

//Set all tables to dump without data and without DROP statement
$dumper->allTables()
	->withData(false)
	->withDrop(false);

//Set table1 to dump with data
$dumper->table('table1')
	->withData(true);

//Set table2 and table3 to dump without structure (data only), and table3 with where condition
$dumper->listTables([
		'table2',
		'table3'
	])
	->withStructure(false)
	->table('table3')
		->where('id=2 OR foo="bar"');

//This will group DROP statements and put them at the beginning of the dump
$dumper->groupDrops(true);

//This will group INSERT statements and put them at the end of the dump
$dumper->groupInserts(true);

$dumper->save('dump.sql');
```

Dumper options
--------------

[](#dumper-options)

### groupDrops(bool $group)

[](#groupdropsbool-group)

When set to TRUE, this will group DROP statements and put them at the beginning of the dump

### groupInserts(bool $group)

[](#groupinsertsbool-group)

When set to TRUE, this will group INSERT statements and put them at the end of the dump

Table selection
---------------

[](#table-selection)

There are 3 basic methods to select tables. When a table or a list of tables are selected, they are returned as TableDumper objects on which you can set options for the dump.

### allTables()

[](#alltables)

Selects all the tables in the DB

### table(string|Table $table)

[](#tablestringtable-table)

Select by table's name (string) or a Table object

### listTables(array $listTables)

[](#listtablesarray-listtables)

Select by a list of table names (string) or Table object

Table options
-------------

[](#table-options)

This is the list of methods available on each each TableDumper

### withStructure(bool $withStructure)

[](#withstructurebool-withstructure)

Whether to dump the table CREATE structure

### withData(bool $withData)

[](#withdatabool-withdata)

Whether to dump table data (INSERT statement)

### withDrop(bool $withDrop)

[](#withdropbool-withdrop)

Wheter to include the DROP statement (before CREATE)

### where(string $where\_string)

[](#wherestring-where_string)

WHERE query string as regular SQL

Output
------

[](#output)

### dump(resource $stream)

[](#dumpresource-stream)

This the main dump function, outputs the dump to a stream.

### save(string $filename)

[](#savestring-filename)

Saves the dump to a file

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/Y0lk/sqldumper/blob/master/LICENSE) for more information.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.5% 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 ~494 days

Recently: every ~613 days

Total

6

Last Release

1041d ago

PHP version history (3 changes)0.1PHP &gt;=5.4.0

0.1.2PHP &gt;=5.5.0

0.2PHP &gt;=7.2.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1523444?v=4)[Gabriel Jean](/maintainers/Y0lk)[@Y0lk](https://github.com/Y0lk)

---

Top Contributors

[![Y0lk](https://avatars.githubusercontent.com/u/1523444?v=4)](https://github.com/Y0lk "Y0lk (32 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (5 commits)")

---

Tags

backupdatabasephpsqldumpmysqlsqlmysql-dump

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/y0lk-sqldumper/health.svg)

```
[![Health](https://phpackages.com/badges/y0lk-sqldumper/health.svg)](https://phpackages.com/packages/y0lk-sqldumper)
```

###  Alternatives

[doctrine/dbal

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

9.7k595.8M6.5k](/packages/doctrine-dbal)[catfan/medoo

The lightweight PHP database framework to accelerate development

4.9k1.5M203](/packages/catfan-medoo)[ifsnop/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k5.8M74](/packages/ifsnop-mysqldump-php)[greenlion/php-sql-parser

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

64112.1M94](/packages/greenlion-php-sql-parser)[cycle/orm

PHP DataMapper ORM and Data Modelling Engine

1.3k888.3k73](/packages/cycle-orm)[aura/sqlquery

Object-oriented query builders for MySQL, Postgres, SQLite, and SQLServer; can be used with any database connection library.

4563.1M37](/packages/aura-sqlquery)

PHPackages © 2026

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