andreas-a / backup-database-bundle
A Symfony bundle that provides a command to easily backup databases.
Installs: 6 601
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/andreas-a/backup-database-bundle
Requires
- php: ^7.3 || ^8.0
- symfony/config: ^4.3 || ^5.0 || ^6.0
- symfony/console: ^4.3 || ^5.0 || ^6.0
- symfony/dependency-injection: ^4.3 || ^5.0 || ^6.0
- symfony/filesystem: ^4.3 || ^5.0 || ^6.0
- symfony/framework-bundle: ^4.3 || ^5.0 || ^6.0
- symfony/http-kernel: ^4.3 || ^5.0 || ^6.0
- symfony/process: ^4.3 || ^5.0 || ^6.0
- symfony/yaml: ^4.3 || ^5.0 || ^6.0
This package is auto-updated.
Last update: 2025-10-08 18:52:03 UTC
README
This bundle is not maintained anymore!
General
A Symfony bundle that provides a command to easily backup databases.
Note: For now only MySQL is supported. It should also support MariaDB, but that has not been verified.
Requirements
- See
composer.jsonfor most dependencies. - A Unix-like OS.
- The following commands:
mkfifomysqldumpbzip2
- For now the above commands have to be available globally in the current path configuration in the corresponding shell used by the
symfony/processcomponent, so they can be called without requiring the absolute path.
Setup
- Add
AndreasA\BackupDatabaseBundle\AndreasABackupDatabaseBundle::class => ['all' => true],toconfig/bundles.php, if it has not been added bysymfony/flexalready. - Add the file
config/packages/andreas_a_backup_database.yamlwith a content like (example configuration):andreas_a_backup_database: database_url: '%env(resolve:DATABASE_URL)%' target_directory: '%kernel.project_dir%/var/backup' mysql: ignored_tables: - 'cache_items' options: - 'default-character-set=utf8mb4' - 'hex-blob' - 'no-tablespaces' - 'opt' - 'routines' - 'triggers' platform_specific_options: - 'column-statistics=0' - 'skip-column-statistics'
Configuration
database_url: The URL to the database.target_directory: The directory where the backups are placed. Those files include the current date and time in their filenames.mysql: Specific options for MySQL backups.ignored_tables: Tables to be ignored during backup. Can also be set to[], if no tables should be ignored.options: These options are used during backup and provided using the MySQL configuration file syntax. Themysqldumpcommand has to support these options. Can also be set to[], if no additional options are necessary.platform_specific_options: Basically the same asoptionsbut here the bundle first checks if themysqldumpcommand supports these options. This is relevant, if you do not know the usedmysqldumpversion. Can also be set to[], if no platform specific options are necessary.
Command
The bundle provides the Symfony command andreas-a:backup:database. It uses the configuration above to create a database backup and can e.g. be used during deployments.