PHPackages                             davmixcool/php-dbcloud - 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. davmixcool/php-dbcloud

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

davmixcool/php-dbcloud
======================

Easily backup PostgreSql or MySql database to the cloud

0.8.2(7y ago)111.5k4MITPHPPHP ^5.5.9 || ^7.0

Since Jul 24Pushed 7y ago3 watchersCompare

[ Source](https://github.com/davmixcool/php-dbcloud)[ Packagist](https://packagist.org/packages/davmixcool/php-dbcloud)[ Docs](https://github.com/davmixcool/php-dbcloud)[ RSS](/packages/davmixcool-php-dbcloud/feed)WikiDiscussions master Synced 3w ago

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

PHP-DBCLOUD
===========

[](#php-dbcloud)

PHP-DBCLOUD is a php library that creates backup of your PostgreSql / MySql database and uploads it to the cloud. It also support restoring of the backedup database from the cloud.

[![GitHub license](https://camo.githubusercontent.com/4613ee5db3b67b1c394401fd00603a5aae1b61626d7d3699cb34455bdb3ace9b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6461766d6978636f6f6c2f7068702d6462636c6f75642e737667)](https://github.com/davmixcool/php-dbcloud/blob/master/LICENSE)[![GitHub issues](https://camo.githubusercontent.com/e2a83b0d622a30460c1a1afb7f28c9fbfd29025c6cb0a4219abfb74a1b2103ef/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6461766d6978636f6f6c2f7068702d6462636c6f75642e737667)](https://github.com/davmixcool/php-dbcloud/issues)[![StyleCI](https://camo.githubusercontent.com/4f2aa0e4c00fdcc3b59dfa080317cfcbcf06e6423204aaf5cab22bf762968552/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3134323032363931312f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/142026911)[![Coverage Status](https://camo.githubusercontent.com/8186b8cb6345fa33d52be68aef63ac1633bb11f5900701153f28846e2cc71ca3/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6461766d6978636f6f6c2f7068702d6462636c6f75642f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/davmixcool/php-dbcloud?branch=master)

Features
--------

[](#features)

- Creating backups

    - MySQL
    - PostgreSQL
- Compress backups

    - gZip
- Sync backups to other locations

    - Amazon s3
    - Dropbox
    - Google Cloud Storage
    - FTP
    - SFTP

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

[](#requirements)

- PHP 5.5
- 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

Steps:
------

[](#steps)

- [Install](#install)
- [Configuration](#configuration)
    - [Configure your databases](#configure-your-databases)
    - [Configure your filesystems](#configure-your-filesystems)
- [Usage](#usage)
    - [Bootstrap the package](#bootstrap-the-package)
    - [Backup to configured database](#backup-to-configured-database)
    - [Restore from configured database](#restore-from-configured-database)
- [Example](#example)

### Install

[](#install)

**Composer**

Run the following to include this via Composer

```
composer require davmixcool/php-dbcloud
```

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

```
# to support Amazon s3
composer require league/flysystem-aws-s3-v3

# to support Dropbox (api v1)
composer require srmklive/flysystem-dropbox

# to support Dropbox (api v2)
composer require srmklive/flysystem-dropbox-v2

# to support Google Cloud Storage
composer require league/flysystem-aws-s3-v2

# to support Sftp
composer require league/flysystem-sftp
```

### Configuration

[](#configuration)

#### Configure your databases

[](#configure-your-databases)

```
//config/database.php

return [

    'development' => [
        'type' => 'mysql',
        'host' => 'localhost',
        'port' => '3306',
        'user' => 'root',
        'pass' => 'password',
        'database' => 'test',
        // If singleTransaction is set to true, the --single-transcation flag will be set.
        'singleTransaction' => false,
        // Do not dump the given tables
        // Set only table names, without database name
        // Example: ['table1', 'table2']
        // http://dev.mysql.com/doc/refman/5.7/en/mysqldump.html#option_mysqldump_ignore-table
        'ignoreTables' => [],
        // using ssl to connect to your database - active ssl-support (mysql only):
        'ssl'=>false,
        // add additional options to dump-command (like '--max-allowed-packet')
        'extraParams'=>null,
    ],
    'production' => [
        'type' => 'postgresql',
        'host' => 'localhost',
        'port' => '5432',
        'user' => 'postgres',
        'pass' => 'password',
        'database' => 'test',
    ],
]
```

#### Configure your filesystems

[](#configure-your-filesystems)

```
// config/storage.php
return [

    'local' => [
        'type' => 'Local',
        'root' => '/path/to/working/directory',
     ],
    's3' => [
        'type' => 'AwsS3',
        'key'    => '',
        'secret' => '',
        'region' => 'us-east-1',
        'version' => 'latest',
        'bucket' => '',
        'root'   => '',
    ],
    'gcs' => [
        'type' => 'Gcs',
        'key'    => '',
        'secret' => '',
        'version' => 'latest',
        'bucket' => '',
        'root'   => '',
    ],
    'dropbox-v2' => [
        'type' => 'DropboxV2',
        'token' => '',
        'key' => '',
        'secret' => '',
        'app' => '',
        'root' => '',
    ],
    'dropbox-v1' => [
        'type' => 'DropboxV1',
        'token' => '',
        'key' => '',
        'secret' => '',
        'app' => '',
        'root' => '',
     ],
    'ftp' => [
        'type' => 'Ftp',
        'host' => '',
        'username' => '',
        'password' => '',
        'root' => '',
        'port' => 21,
        'passive' => true,
        'ssl' => true,
        'timeout' => 30,
    ],
    'sftp' => [
        'type' => 'Sftp',
        'host' => '',
        'username' => '',
        'password' => '',
        'root' => '',
        'port' => 21,
        'timeout' => 10,
        'privateKey' => '',
    ],
]
```

### Usage

[](#usage)

Once installed, the package must be bootstrapped with initial configurations before it can be used.

#### Bootstrap the package

[](#bootstrap-the-package)

```
use PhpDbCloud\Config\Config;
use PhpDbCloud\Filesystems;
use PhpDbCloud\Databases;
use PhpDbCloud\Compressors;
use PhpDbCloud\Sync;

// build providers
$filesystems = new Filesystems\FilesystemProvider(Config::fromPhpFile('config/storage.php'));
$filesystems->add(new Filesystems\Awss3Filesystem);
$filesystems->add(new Filesystems\GcsFilesystem);
$filesystems->add(new Filesystems\DropboxV1Filesystem);
$filesystems->add(new Filesystems\DropboxV2Filesystem);
$filesystems->add(new Filesystems\FtpFilesystem);
$filesystems->add(new Filesystems\LocalFilesystem);
$filesystems->add(new Filesystems\SftpFilesystem);

$databases = new Databases\DatabaseProvider(Config::fromPhpFile('config/database.php'));
$databases->add(new Databases\MysqlDatabase);
$databases->add(new Databases\PostgresqlDatabase);

$compressors = new Compressors\CompressorProvider;
$compressors->add(new Compressors\GzipCompressor);
$compressors->add(new Compressors\NullCompressor);

// build sync
return new Sync($filesystems, $databases, $compressors);
```

#### Backup to configured database

[](#backup-to-configured-database)

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

```
use PhpDbCloud\Filesystems\Destination;

$sync = require 'bootstrap.php';
$sync->makeBackup()->run('development', [new Destination('dropbox-v2', 'test/backup.sql')], 'gzip');
```

#### Restore from configured database

[](#restore-from-configured-database)

Restore the database file `test/backup.sql.gz` from `Dropbox Api V2` to the `development` database.

```
$sync = require 'bootstrap.php';
$sync->makeRestore()->run('dropbox-v2', '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.

### Example

[](#example)

See Example [here](https://github.com/davmixcool/php-dbcloud/tree/master/example).

### Maintainers

[](#maintainers)

This package is maintained by [David Oti](http://fb.me/davmixcool) and you!

### License

[](#license)

This package is licensed under the [MIT license](https://github.com/davmixcool/php-dbcloud/blob/master/LICENSE).

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity50

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

Total

3

Last Release

2771d ago

PHP version history (2 changes)0.8.0PHP &gt;=5.5.9

0.8.2PHP ^5.5.9 || ^7.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5640065?v=4)[David Oti](/maintainers/davmixcool)[@davmixcool](https://github.com/davmixcool)

---

Top Contributors

[![davmixcool](https://avatars.githubusercontent.com/u/5640065?v=4)](https://github.com/davmixcool "davmixcool (19 commits)")

---

Tags

databasemysqlpostgresqlsqldb

### Embed Badge

![Health badge](/badges/davmixcool-php-dbcloud/health.svg)

```
[![Health](https://phpackages.com/badges/davmixcool-php-dbcloud/health.svg)](https://phpackages.com/packages/davmixcool-php-dbcloud)
```

###  Alternatives

[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)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[atlas/query

Object-oriented query builders and performers for MySQL, Postgres, SQLite, and SQLServer.

41253.7k7](/packages/atlas-query)[aura/sqlschema

Provides facilities to read table names and table columns from a database using PDO.

41240.2k4](/packages/aura-sqlschema)[rah/danpu

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

62410.3k11](/packages/rah-danpu)

PHPackages © 2026

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