PHPackages                             eugabrielsilva/sql-dumper - 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. eugabrielsilva/sql-dumper

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

eugabrielsilva/sql-dumper
=========================

SQL backup dumper made in pure PHP

v1.2.0(3mo ago)084MITPHPPHP &gt;=7.4

Since Oct 19Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/eugabrielsilva/sql-dumper)[ Packagist](https://packagist.org/packages/eugabrielsilva/sql-dumper)[ Docs](https://gabrielsilva.dev.br)[ RSS](/packages/eugabrielsilva-sql-dumper/feed)WikiDiscussions main Synced today

READMEChangelog (3)DependenciesVersions (4)Used By (0)

SQLDumper
=========

[](#sqldumper)

This is a PHP package designed to generate an **SQL dump from a MySQL database using pure PHP**, without needing to rely on `mysqldump` or other tools.

[![Latest Version](https://camo.githubusercontent.com/740df2337680aa55ddd9bf642fd39389b0dd4335856f674f8fb9edd41e8ae4c0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f65756761627269656c73696c76612f73716c2d64756d706572)](https://packagist.org/packages/eugabrielsilva/sql-dumper)[![Total Downloads](https://camo.githubusercontent.com/2449b7c468087d232934c57ccee8ca360fae5d367b7e4247382aac64737cc912/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f65756761627269656c73696c76612f73716c2d64756d706572)](https://packagist.org/packages/eugabrielsilva/sql-dumper)[![License](https://camo.githubusercontent.com/1882974a6868de19f84c54ad4029939c61029b9d63ee2873212d78b4ddde7526/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f65756761627269656c73696c76612f73716c2d64756d706572)](https://packagist.org/packages/eugabrielsilva/sql-dumper)[![PHP Version](https://camo.githubusercontent.com/8ff65b76474a5272d25299498c478dc0d4dba93112150f3cd3e9d183b3235449/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f65756761627269656c73696c76612f73716c2d64756d706572)](https://packagist.org/packages/eugabrielsilva/sql-dumper)

### Requirements

[](#requirements)

- PHP version 7.4 or higher with **pdo\_mysql** and **mbstring** extensions enabled
- MySQL server and a user with `SHOW` and `SELECT` privileges

### Installation

[](#installation)

**Through Composer:**

```
composer require eugabrielsilva/sql-dumper

```

**Manual installation:**
Copy `src/SQLDumper.php` and include it in your script.

### Usage

[](#usage)

```
// Include Composer packages if not yet
require 'vendor/autoload.php';

// Create SQLDumper instance
$db = new \GabrielSilva\SQLDumper\SQLDumper();

// Set your server settings (optional)
$db->host = 'localhost';
$db->user = 'root';
$db->password = '';
$db->db = 'app';

// Generate dump to an SQL file
$db->dumpToFile('backup.sql');

// You can also dump to a string
$dump = $db->dumpToString();
```

### Options

[](#options)

There are a few options that you can use to modify SQLDumper, these options are properties from the instance that can be overwritten.

**Note:** values shown below are the default ones.

```
$db->host = 'localhost'; // Server hostname
$db->user = 'root'; // Username to connect to the database
$db->password = ''; // User password
$db->db = 'app'; // Database name
$db->port = 3306; // Server port
$db->charset = 'utf8'; // Database charset
$db->includes = []; // Array of tables to include in dump, empty for all
$db->excludes = []; // Array of tables to exclude from dump
$db->includesData = []; // Array of tables to include data in dump, empty for all
$db->excludesData = []; // Array of tables to exclude data from dump
$db->createTables = true; // Include CREATE TABLE statements in dump
$db->createDatabase = false; // Include CREATE DATABASE statement in dump
$db->dropTables = false; // Include DROP TABLE statements in dump
$db->dropDatabase = false; // Include DROP DATABASE statement in dump
$db->insertData = true; // Include data in dump
$db->deleteData = false; // TRUNCATE data from tables before inserting
$db->insertType = 'INSERT'; // Insert type: INSERT, INSERT IGNORE or REPLACE
$db->safeMode = true; // Use IF EXISTS and IF NOT EXISTS checks in dump
$db->chunkSize = 3000; // Number of rows to fetch per query (useful on large tables)
```

Important

If you change any of the server options, like `host`, `user`, `password`, `db`, `port` or `charset`, you need to refresh the database connection by calling `$db->connect()` method.

### Credits

[](#credits)

Package developed and maintained by [Gabriel Silva](https://github.com/eugabrielsilva).

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance80

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 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 ~623 days

Total

3

Last Release

106d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/64693687?v=4)[Gabriel Silva](/maintainers/eugabrielsilva)[@eugabrielsilva](https://github.com/eugabrielsilva)

---

Top Contributors

[![eugabrielsilva](https://avatars.githubusercontent.com/u/64693687?v=4)](https://github.com/eugabrielsilva "eugabrielsilva (6 commits)")

---

Tags

backupphpsqlphpbackupdumpsql

### Embed Badge

![Health badge](/badges/eugabrielsilva-sql-dumper/health.svg)

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

###  Alternatives

[rah/danpu

Zero-dependency MySQL dump library for easily exporting and importing databases

62414.3k11](/packages/rah-danpu)[clouddueling/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k23.2k](/packages/clouddueling-mysqldump-php)[friedolinfoerder/wp-activerecord

An ActiveRecord implementation for WordPress

237.8k](/packages/friedolinfoerder-wp-activerecord)

PHPackages © 2026

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