PHPackages                             clevis/database-backup - 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. clevis/database-backup

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

clevis/database-backup
======================

v1.0.0(12y ago)4257[1 issues](https://github.com/Clevis/DatabaseBackup/issues)MITPHP

Since Nov 26Pushed 10y ago6 watchersCompare

[ Source](https://github.com/Clevis/DatabaseBackup)[ Packagist](https://packagist.org/packages/clevis/database-backup)[ RSS](/packages/clevis-database-backup/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (4)Versions (3)Used By (0)

DatabaseBackup Tool
===================

[](#databasebackup-tool)

Tiny wrapper around [Clevis/MySQLDump](https://github.com/Clevis/MySQL-dump) library which can limit the maximum number of kept backups. The kept backups are efficiently distributed over the whole period of time this tool is being used. The older the backups are the larger time gap is kept between them.

**Visualisation of backups distribution in time**

[![Backups distribution in time](docs/images/time-distribution.png)](docs/images/time-distribution.png)

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

[](#installation)

The recommended way to install this library is to use [Composer](http://getcomposer.org/).

```
composer require clevis/database-backup

```

Basic Usage
-----------

[](#basic-usage)

```
$mysqli = new mysqli('localhost', 'root', 'password', 'database');
$dumper = new MySQLDump($mysqli);

// store backups to directory './backups' and keep at most 100 backups
$backup = new Clevis\DatabaseBackup\DatabaseBackup($dumper, __DIR__ . '/backups', 100);
$backup->backupDatabase();
```

If you use [dibi](http://dibiphp.com), then you can get the `$mysqli` object this way:

```
$mysqli = $dibiConnection->getDriver()->getResource();
```

Advanced Usage
--------------

[](#advanced-usage)

You can customize the created dumps by configuring the `$dumper` instance.

1. Do not dump table `foo`:

    ```
    $dumper->tables['foo'] = $dumper::NONE;
    ```
2. Dump only structure, but not data of table `foo`:

    ```
    // CREATE TABLE `foo` (...)
    $dumper->tables['foo'] = $dumper::CREATE;

    // DROP TABLE `foo` IF EXISTS + CREATE TABLE `foo` (...)
    $dumper->tables['foo'] = $dumper::CREATE | $dumper::DROP;
    ```
3. Dump only some rows in table `foo`:

    ```
    $dumper->setCustomDataSelect('foo', 'SELECT * FROM `foo` WHERE `bar` = 1');
    ```
4. Do not lock tables while dumping tables:

    ```
    $dumper->setUseLock(FALSE);
    ```
5. For more examples see [documentation of Clevis/MySQLDump](https://github.com/Clevis/MySQL-dump) library.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity64

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

Total

2

Last Release

4484d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6163a0eec16c2bfc9cce0c7c8801b5166cca9af81a146764676059a965044000?d=identicon)[JanTvrdik](/maintainers/JanTvrdik)

---

Top Contributors

[![JanTvrdik](https://avatars.githubusercontent.com/u/175109?v=4)](https://github.com/JanTvrdik "JanTvrdik (7 commits)")

---

Tags

backupmysql

### Embed Badge

![Health badge](/badges/clevis-database-backup/health.svg)

```
[![Health](https://phpackages.com/badges/clevis-database-backup/health.svg)](https://phpackages.com/packages/clevis-database-backup)
```

###  Alternatives

[phpbu/phpbu

PHP Backup utility.

1.3k89.0k4](/packages/phpbu-phpbu)[rah/danpu

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

64401.8k10](/packages/rah-danpu)[cytopia/mysqldump-secure

Secure mysqldump script with encryption, compression, logging, blacklisting and Nagios monitoring integration

1474.7k1](/packages/cytopia-mysqldump-secure)

PHPackages © 2026

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