PHPackages                             xedin/symfony2-db-backup-bundle - 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. xedin/symfony2-db-backup-bundle

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

xedin/symfony2-db-backup-bundle
===============================

Fork of https://github.com/dizda/CloudBackupBundle. Used to create backup of selected db (mongo / mysql / etc)

1.4.0(12y ago)192MITPHPPHP &gt;=5.3.2

Since Feb 20Pushed 12y ago1 watchersCompare

[ Source](https://github.com/xedinaska/BackupBundle)[ Packagist](https://packagist.org/packages/xedin/symfony2-db-backup-bundle)[ Docs](https://github.com/dizda/CloudBackupBundle)[ RSS](/packages/xedin-symfony2-db-backup-bundle/feed)WikiDiscussions master Synced 2mo ago

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

[![Build Status](https://camo.githubusercontent.com/eb3a19097ee55d3211e25b799ca763f9639c5aebec93d64e7ad0aea3198abcd9/68747470733a2f2f7472617669732d63692e6f72672f64697a64612f4261636b757042756e646c652e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/dizda/BackupBundle)BackupBundle
=================================================================================================================================================================================================================================================================================================

[](#backupbundle)

This bundle helps you to backup your databases and upload it to the cloud with only one Symfony2 command.

You can :

- Dump one database
- Dump all databases
- Different types of databases can be dumped each time
- Upload to several Cloud services

Databases supported :

- MongoDB
- MySQL
- PostgreSQL (excluding all\_databases option)

Cloud services supported :

- **Dropbox** (with the help of [DropboxUploader by hakre](https://github.com/hakre/DropboxUploader))
- **CloudApp** (thanks to [CloudAPP-API-PHP-wrapper](https://github.com/matthiasplappert/CloudApp-API-PHP-wrapper))
- **Amazon S3** (through [KnpGaufretteBundle](https://github.com/KnpLabs/KnpGaufretteBundle))
- Google Drive (soon..)

But also :

- **Local** (through [KnpGaufretteBundle](https://github.com/KnpLabs/KnpGaufretteBundle))
- **FTP** (through [KnpGaufretteBundle](https://github.com/KnpLabs/KnpGaufretteBundle))
- **sFTP** (through [KnpGaufretteBundle](https://github.com/KnpLabs/KnpGaufretteBundle))
- **GridFS** (through [KnpGaufretteBundle](https://github.com/KnpLabs/KnpGaufretteBundle))
- **MogileFS** (through [KnpGaufretteBundle](https://github.com/KnpLabs/KnpGaufretteBundle))

are supported :-)

Installation (&gt;=Symfony 2.1)
-------------------------------

[](#installation-symfony-21)

### Composer

[](#composer)

Download BackupBundle and its dependencies to the vendor directory. You can use Composer for the automated process:

```
$ php composer.phar require dizda/cloud-backup-bundle dev-master
```

Composer will install the bundle to `vendor/dizda` directory.

### Adding bundle to your application kernel

[](#adding-bundle-to-your-application-kernel)

```
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Knp\Bundle\GaufretteBundle\KnpGaufretteBundle(),
        new Dizda\BackupBundle\DizdaBackupBundle(),
        // ...
    );
}
```

Configuration
-------------

[](#configuration)

Here is the default configuration for the bundle:

```
dizda_backup:
    # By default backup files will have your servers hostname as prefix
    # such as: hostname_2014_01_01-21_08_39.tar
    output_file_prefix: hostname
    cloud_storages:
        # Dropbox account credentials (use parameters in config.yml and store real values in prameters.yml)
        dropbox:
            user:     ~  # Required
            password: ~  # Required
            remote_path: ~ # Not required, default "/", but you can use path like "/Accounts/backups/"
        # CloudApp account. Can be optional, like dropbox.
        cloudapp:
            user:        ~ # Required
            password:    ~ # Required
        # or you can use Gaufrette as well (optional)
        gaufrette:
            service_name: ~  # Gaufrette filesystem service name

    databases:
        mongodb:
            all_databases: false # Only required when no database is set
            database:     ~ # Required if all_databases is false
            db_user:     ~ # Not required, leave empty if no auth is required
            db_password: ~ # Not required

        mysql:
            all_databases: false # Only required when no database is set
            database: ~          # Required if all_databases is false
            db_host: localhost   # This, and following is not required and if not specified, the bundle will take ORM configuration in parameters.yml
            db_port: ~           # Default 3306
            db_user: ~
            db_password: ~

        postgresql:
            database: dbname     # Required
            db_host: localhost   # This, and following is not required and if not specified, the bundle will take ORM configuration in parameters.yml
            db_port: ~           # Default 5432
            db_user: ~
            db_password: ~
```

It is recommended to keep real values for logins and passwords in your parameters.yml file, e.g.:

```
# app/config/config.yml
dizda_backup:
    cloud_storages:
        dropbox:
            user:        %dizda_cloud_dropbox_user%
            password:    %dizda_cloud_dropbox_password%
            remote_path: %dizda_cloud_dropbox_remote_path%

    databases:
        mongodb:
            all_databases: false
            database: %dizda_cloud_mongodb_user%
            db_user:  %dizda_cloud_mongodb_user%
            db_pass:  %dizda_cloud_mongodb_password%

        mysql:
            # When no parameters is specified under mysql, the bundle taking those from parameters.yml

        postgresql:
            # When no parameters is specified under postgresql, the bundle taking those from parameters.yml
```

```
# app/config/parameters.yml
	# ...
    database_driver: pdo_mysql
    database_host: localhost
    database_port: null
    database_name: myDatabase
    database_user: myLogin
    database_password: myDatabasePassword
    # ...
    dizda_cloud_dropbox_user:     myDropboxUser
    dizda_cloud_dropbox_password: MyDropboxPassword
    dizda_cloud_mongodb_user:     mongodbUser
    dizda_cloud_mongodb_password: mongodbPass
	# ...
```

Usage
-----

[](#usage)

The bundle adds one command to symfony console: `app/console dizda:backup:start` which you execute periodically as a cron job. For example the following cron command dumps your database every days at 6am on a server :

```
# m h  dom mon dow   command
0 6 * * * php /opt/www/symfony-project/app/console dizda:backup:start

```

Info : To edit crontab for the user www-data (to prevent permissions error) :

```
$ crontab -u www-data -e
```

or simply

```
$ php app/console dizda:backup:start
```

[![](https://github.com/dizda/BackupBundle/raw/master/Resources/doc/dizda-Cloud-Backup-Bundle-symfony2.png)](https://github.com/dizda/BackupBundle/raw/master/Resources/doc/dizda-Cloud-Backup-Bundle-symfony2.png)

Capifony integration
--------------------

[](#capifony-integration)

If you are using capifony for deployment you can grab the sample task for easier backups.

Add the following task in your deploy.rb file

```
namespace :symfony do
    namespace :dizda do
        namespace :backup do
            desc "Upload a backup of your database to cloud service's"
            task :start do
                run "#{try_sudo} sh -c 'cd #{current_release} && #{php_bin} #{symfony_console} dizda:backup:start #{console_options}'"
            end
        end
    end
end
```

This adds symfony:dizda:backup:start command to capifony. To launch it automatically on deploy you might use:

```
# 1) Launches backup right before deploy
before "deploy", "symfony:dizda:backup:start"

# 2) Launches backup after deploy
after "deploy", "symfony:dizda:backup:start"
```

End
---

[](#end)

This bundle was inspired from [KachkaevDropboxBackupBundle](https://github.com/kachkaev/KachkaevDropboxBackupBundle).

It is Symfony2.1, 2.2 and 2.3 compatible, I'll make some tests as soon as time permits.

Enjoy, PR are welcome !

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 82.8% 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 ~54 days

Total

5

Last Release

4608d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c50cbd58ac18560a706bed22468405d950f685b1e8221b6ebd87ebad56c6e082?d=identicon)[Xedin](/maintainers/Xedin)

---

Top Contributors

[![dizda](https://avatars.githubusercontent.com/u/1245245?v=4)](https://github.com/dizda "dizda (111 commits)")[![xedinaska](https://avatars.githubusercontent.com/u/4207843?v=4)](https://github.com/xedinaska "xedinaska (9 commits)")[![eymengunay](https://avatars.githubusercontent.com/u/242627?v=4)](https://github.com/eymengunay "eymengunay (7 commits)")[![imanzuk](https://avatars.githubusercontent.com/u/1284755?v=4)](https://github.com/imanzuk "imanzuk (4 commits)")[![mikemeier](https://avatars.githubusercontent.com/u/776406?v=4)](https://github.com/mikemeier "mikemeier (2 commits)")[![JoydS](https://avatars.githubusercontent.com/u/480070?v=4)](https://github.com/JoydS "JoydS (1 commits)")

---

Tags

symfonydatabasedumpmysqlmongodbdropboxcloudappGoogleDriveGDrive

### Embed Badge

![Health badge](/badges/xedin-symfony2-db-backup-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/xedin-symfony2-db-backup-bundle/health.svg)](https://phpackages.com/packages/xedin-symfony2-db-backup-bundle)
```

###  Alternatives

[mmucklo/queue-bundle

Symfony2/3/4/5 Queue Bundle (for background jobs) supporting Mongo (Doctrine ODM), Mysql (and any Doctrine ORM), RabbitMQ, Beanstalkd, Redis, and ... {write your own}

120839.8k](/packages/mmucklo-queue-bundle)[backup-manager/symfony

A simple database backup manager for Symfony2 with support for S3, Rackspace, Dropbox, FTP, SFTP.

119293.7k3](/packages/backup-manager-symfony)[facile-it/mongodb-bundle

Bundle service integration of official \[mongodb/mongo-php-library\](https://github.com/mongodb/mongo-php-library) driver library

38212.1k1](/packages/facile-it-mongodb-bundle)[doesntmattr/mongodb-migrations-bundle

Symfony MongoDBMigrationsBundle

23484.5k1](/packages/doesntmattr-mongodb-migrations-bundle)[rah/danpu

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

64401.8k10](/packages/rah-danpu)

PHPackages © 2026

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