PHPackages                             hgg/dbbackup - 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. hgg/dbbackup

ActiveLibrary

hgg/dbbackup
============

Create backup files of databases or individual tables and restore from dump files

5351PHP

Since Nov 7Pushed 11y ago2 watchersCompare

[ Source](https://github.com/hglattergotz/dbbackup)[ Packagist](https://packagist.org/packages/hgg/dbbackup)[ RSS](/packages/hgg-dbbackup/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

**No longer maintained! Please use  instead**

Programmatically create dump files of an entire database or individual tables in a PHP application. Restore from dump files.

[![Build Status](https://camo.githubusercontent.com/7b99f973c1064321712223a1ab39f8391baabeae716c54256edc8c6507b2dc56/68747470733a2f2f7472617669732d63692e6f72672f68676c6174746572676f747a2f64626261636b75702e706e67)](https://travis-ci.org/hglattergotz/dbbackup)

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

[](#installation)

Using Composer:

```
{
    "require": {
        "hgg/dbbackup": "dev-master"
    }
}
```

Download source and manually add to project:

- Get the zip file [here](http://github.com/hglattergotz/dbbackup/archive/master.zip)

Supported Databases:
--------------------

[](#supported-databases)

- MySql

Pull Requests for additional database engines welcome!

Usage
-----

[](#usage)

### Backup entire database

[](#backup-entire-database)

```
use HGG\DbBackup\CmdBuilder\MySql;
use HGG\DbBackup\DbBackup;

try
{
    $output = '';
    $backup = new DbBackup(new MySql());
    $backup->backupDb('username', 'password', 'localhost', 'database',
        'backupFile', array(), &$output);

    // log $output
}
catch (\Exception $e)
{
    // deal with failure
}
```

### Backup specific tables in a database

[](#backup-specific-tables-in-a-database)

```
use HGG\DbBackup\CmdBuilder\MySql;
use HGG\DbBackup\DbBackup;

try
{
    $output = '';
    $backup = new DbBackup(new MySql());
    $backup->backupTables('username', 'password', 'localhost', 'database',
        array('table1', 'table2'), 'backupFile', array(), &$output);

    // log $output
}
catch (\Exception $e)
{
    // deal with failure
}
```

### Restore form a dump file

[](#restore-form-a-dump-file)

```
use HGG\DbBackup\CmdBuilder\MySql;
use HGG\DbBackup\DbRestore;

try
{
    $output = '';
    $restore = new DbRestore(new MySql());
    $restore->restore('username', 'password', 'localhost', 'database',
        'backupFile', array(), &$output);

    // log $output
}
catch (\Exception $e)
{
    // deal with failure
}
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/506901?v=4)[Henning Glatter-Götz](/maintainers/hglattergotz)[@hglattergotz](https://github.com/hglattergotz)

---

Top Contributors

[![hglattergotz](https://avatars.githubusercontent.com/u/506901?v=4)](https://github.com/hglattergotz "hglattergotz (17 commits)")

### Embed Badge

![Health badge](/badges/hgg-dbbackup/health.svg)

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

PHPackages © 2026

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