PHPackages                             fezfez/backup-manager - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. fezfez/backup-manager

ActiveLibrary[File &amp; Storage](/categories/file-storage)

fezfez/backup-manager
=====================

A framework agnostic database backup manager with user-definable procedures and support for S3, Dropbox, FTP, SFTP, and more with drivers for popular frameworks.

0.4.2(3y ago)01.6k1[4 PRs](https://github.com/fezfez/backup-manager/pulls)2MITPHPPHP ~8.1.0 || ~8.2.0

Since May 16Pushed 2y agoCompare

[ Source](https://github.com/fezfez/backup-manager)[ Packagist](https://packagist.org/packages/fezfez/backup-manager)[ RSS](/packages/fezfez-backup-manager/feed)WikiDiscussions master Synced yesterday

READMEChangelog (6)Dependencies (6)Versions (13)Used By (2)

Database Backup Manager
=======================

[](#database-backup-manager)

[![Build Status](https://github.com/fezfez/backup-manager/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/fezfez/backup-manager/actions/workflows/continuous-integration.yml)[![Type Coverage](https://camo.githubusercontent.com/e765ee86ed61323109fda49bab816014b8edf939e504396644c96d5672eae443/68747470733a2f2f73686570686572642e6465762f6769746875622f66657a66657a2f6261636b75702d6d616e616765722f636f7665726167652e737667)](https://shepherd.dev/github/fezfez/backup-manager)[![Type Coverage](https://camo.githubusercontent.com/3034beeb5a19af318645a5894889840a4e90e0bdc1b26b18bc32134c2083fd4c/68747470733a2f2f73686570686572642e6465762f6769746875622f66657a66657a2f6261636b75702d6d616e616765722f6c6576656c2e737667)](https://shepherd.dev/github/fezfez/backup-manager)[![Latest Stable Version](https://camo.githubusercontent.com/bc6da0b6932b1e3138ce651ba51930867c6308b7453c0bd3e416d29b2e835d7c/68747470733a2f2f706f7365722e707567782e6f72672f66657a66657a2f6261636b75702d6d616e616765722f762f737461626c65)](https://packagist.org/packages/fezfez/backup-manager)[![License](https://camo.githubusercontent.com/e4d3b663b23f8ac69236a67ce319407bb0ab0e2cd4d5604d7cd94647aea0a1a7/68747470733a2f2f706f7365722e707567782e6f72672f66657a66657a2f6261636b75702d6d616e616765722f6c6963656e7365)](https://packagist.org/packages/fezfez/backup-manager)

This package provides a framework-agnostic database backup manager for dumping to and restoring databases from any file system.

- supports `MySQL` and `PostgreSQL`
- compress with `Gzip`
- framework-agnostic
- dead simple configuration

Quick and Dirty
---------------

[](#quick-and-dirty)

**Backup to / restore from any configured database.**

Backup the development database to `Amazon S3`. The S3 backup path will be `test/backup.sql.gz` in the end, when `gzip` is done with it.

```
$local = new \League\Flysystem\Adapter\Local(getcwd() . '/data/');
$webdav = new \League\Flysystem\WebDAV\WebDAVAdapter(new \Sabre\DAV\Client([
    'baseUri' => getenv('WEBDAV_HOST'),
    'userName' => getenv('WEBDAV_username'),
    'password' => getenv('WEBDAV_password'),
]), 'remote.php/webdav/');

$manager = \Fezfez\BackupManager\BackupManager::create();
$manager->backup(
    new LeagueFilesystemAdapaterV1($local),
    new \Fezfez\BacpkupManager\Databases\MysqlDatabase(
        getenv('DB_HOST'),
        getenv('DB_PORT'),
        getenv('DB_USER'),
        getenv('DB_PASSWORD'),
        getenv('DB_DATABASE')
    ),
  [
    new \Fezfez\BackupManager\Filesystems\Destination(new LeagueFilesystemAdapaterV1($webdav), 'test/backup.sql')
  ],
  \Fezfez\BackupManager\Compressors\GzipCompressor::create()
);

$manager->restore(
    new LeagueFilesystemAdapaterV1($local),
    new LeagueFilesystemAdapaterV1($webdav),
    'test/backup.sql',
    new \Fezfez\BacpkupManager\Databases\MysqlDatabase(
        getenv('DB_HOST'),
        getenv('DB_PORT'),
        getenv('DB_USER'),
        getenv('DB_PASSWORD'),
        getenv('DB_DATABASE')
    ),
  \Fezfez\BackupManager\Compressors\GzipCompressor::create()
);
```

### Backup to / restore from any configured filesystem

[](#backup-to--restore-from-any-configured-filesystem)

Restore the database file `test/backup.sql.gz` from `Amazon S3` to the `development` database.

```
$manager = require 'bootstrap.php';
$manager->makeRestore()->run('s3', 'test/backup.sql.gz', 'development', 'gzip');
```

> This package does not allow you to backup from one database type and restore to another. A MySQL dump is not compatible with PostgreSQL.

Requirements
------------

[](#requirements)

- PHP ^8.0
- MySQL support requires `mysqldump` and `mysql` command-line binaries
- PostgreSQL support requires `pg_dump` and `psql` command-line binaries
- Gzip support requires `gzip` and `gunzip` command-line binaries

### Installation

[](#installation)

### Composer

[](#composer)

Run the following to include this via Composer

```
composer require fezfez/backup-manager
```

Then, you'll need to select the appropriate packages for the adapters that you want to use.

```
# to support league-flysystem:^1.0
composer require fezfez/backup-manager-league-flysystem-v1

# to support league-flysystem:^2.0
composer require fezfez/backup-manager-league-flysystem-v2

# to support league-flysystem:^3.0
composer require fezfez/backup-manager-league-flysystem-v3
```

Usage
-----

[](#usage)

Once installed, the package must be bootstrapped (initial configuration) before it can be used.

We've provided a native PHP example [here](https://github.com/backup-manager/backup-manager/tree/master/examples).

The required bootstrapping can [be found in the example here](https://github.com/backup-manager/backup-manager/blob/master/examples/standalone/bootstrap.php).

Contribution Guidelines
-----------------------

[](#contribution-guidelines)

We recommend using the vagrant configuration supplied with this package for development and contribution. Simply install VirtualBox, Vagrant, and Ansible then run `vagrant up` in the root folder. A virtualmachine specifically designed for development of the package will be built and launched for you.

When contributing please consider the following guidelines:

- Code style is PSR-2
    - Interfaces should NOT be suffixed with `Interface`, Traits should NOT be suffixed with `Trait`.
- All methods and classes must contain docblocks.
- Ensure that you submit tests that have minimal 100% coverage. Given the project's simplicity it just makes sense.
- When planning a pull-request to add new functionality, it may be wise to [submit a proposal](https://github.com/backup-manager/backup-manager/issues/new) to ensure compatibility with the project's goals.

Backwards Compatibility Breaks
------------------------------

[](#backwards-compatibility-breaks)

### License

[](#license)

This package is licensed under the [MIT license](https://github.com/backup-manager/backup-manager/blob/master/LICENSE). Go wild.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 54.2% 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 ~47 days

Recently: every ~21 days

Total

6

Last Release

1218d ago

PHP version history (2 changes)0.1PHP ~8.0.0 || ~8.1.0

0.2PHP ~8.1.0 || ~8.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/2aacc30f852e940d49eaf76c0cac6a97f3cfe4d38692ea774a57bc634196bda9?d=identicon)[fezfez](/maintainers/fezfez)

---

Top Contributors

[![mitchellvanw](https://avatars.githubusercontent.com/u/3061428?v=4)](https://github.com/mitchellvanw "mitchellvanw (117 commits)")[![fezfez](https://avatars.githubusercontent.com/u/1162307?v=4)](https://github.com/fezfez "fezfez (21 commits)")[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (13 commits)")[![cklm](https://avatars.githubusercontent.com/u/466021?v=4)](https://github.com/cklm "cklm (8 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (6 commits)")[![driesvints](https://avatars.githubusercontent.com/u/594614?v=4)](https://github.com/driesvints "driesvints (4 commits)")[![GizzmoShifu](https://avatars.githubusercontent.com/u/1200724?v=4)](https://github.com/GizzmoShifu "GizzmoShifu (4 commits)")[![bcalik](https://avatars.githubusercontent.com/u/9222368?v=4)](https://github.com/bcalik "bcalik (4 commits)")[![hason](https://avatars.githubusercontent.com/u/288535?v=4)](https://github.com/hason "hason (3 commits)")[![vanodevium](https://avatars.githubusercontent.com/u/16780069?v=4)](https://github.com/vanodevium "vanodevium (3 commits)")[![WyriHaximus](https://avatars.githubusercontent.com/u/147145?v=4)](https://github.com/WyriHaximus "WyriHaximus (2 commits)")[![benbridts](https://avatars.githubusercontent.com/u/1301221?v=4)](https://github.com/benbridts "benbridts (2 commits)")[![chromeorfirefox](https://avatars.githubusercontent.com/u/10752650?v=4)](https://github.com/chromeorfirefox "chromeorfirefox (2 commits)")[![godeg123](https://avatars.githubusercontent.com/u/12759680?v=4)](https://github.com/godeg123 "godeg123 (2 commits)")[![lucasff](https://avatars.githubusercontent.com/u/4260591?v=4)](https://github.com/lucasff "lucasff (2 commits)")[![Shotman](https://avatars.githubusercontent.com/u/6579166?v=4)](https://github.com/Shotman "Shotman (2 commits)")[![Ali1](https://avatars.githubusercontent.com/u/218558?v=4)](https://github.com/Ali1 "Ali1 (2 commits)")[![loren138](https://avatars.githubusercontent.com/u/1224505?v=4)](https://github.com/loren138 "loren138 (1 commits)")[![bberlijn](https://avatars.githubusercontent.com/u/9305845?v=4)](https://github.com/bberlijn "bberlijn (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/fezfez-backup-manager/health.svg)

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

###  Alternatives

[spatie/file-system-watcher

Watch changes in the file system using PHP

2502.1M17](/packages/spatie-file-system-watcher)[verseles/sevenzip

A package to compress and decompress files using 7zip

191.7k](/packages/verseles-sevenzip)

PHPackages © 2026

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