├── BMBackupManagerBundle.php ├── Changelog.md ├── Command ├── BackupCommand.php └── RestoreCommand.php ├── DependencyInjection ├── BMBackupManagerExtension.php └── Configuration.php ├── Factory └── ConfigFactory.php ├── README.md ├── Resources └── config │ └── services.yml └── composer.json /BMBackupManagerBundle.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class BMBackupManagerBundle extends Bundle 13 | { 14 | } 15 | -------------------------------------------------------------------------------- /Changelog.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## UNRELEASED 4 | 5 | ### Added 6 | 7 | - Add option 'extraParams' for database's config 8 | 9 | ## 3.2.0 10 | 11 | ### Added 12 | 13 | - Support for auto wiring `BackupManager` 14 | 15 | ## 3.1.1 16 | 17 | ### Fixed 18 | 19 | - Removed extra forward slash on DSN path. 20 | 21 | ## 3.1.0 22 | 23 | ### Added 24 | 25 | - "endpoint" option to AwsS3 26 | 27 | ### Fixed 28 | 29 | - RestoreCommand must return int 30 | 31 | ### Changed 32 | 33 | - Updated to version 2 of nyholm/dsn 34 | 35 | ## 3.0.0 36 | 37 | ### Fixed 38 | 39 | - Support for Symfony 5 40 | 41 | ### Changed 42 | 43 | - Removed support for PHP < 7.3 44 | 45 | ## 2.3.0 46 | 47 | ### Added 48 | 49 | - Support for Google cloud storage 50 | - Support for Symfony 5 51 | 52 | ### Changed 53 | 54 | - Removed support for PHP < 7.2 55 | - Removed support Symfony < 3.4 56 | 57 | ## 2.2.0 58 | 59 | ### Fixed 60 | 61 | - Fixed root node deprecation in symfony/config > 4.1 62 | - Adds support for the Backblaze B2 Cloud Storage 63 | 64 | ## 2.1.3 65 | 66 | ### Fixed 67 | 68 | - Fixed bug that made DropboxV2 config unavailable. 69 | 70 | ## 2.1.2 71 | 72 | ### Fixed 73 | 74 | - Support for environment variables in the config. 75 | 76 | ## 2.1.1 77 | 78 | ### Fixed 79 | 80 | - Allow to only use "dsn" without configure "type". 81 | - Add better error message when both "dsn" and "type" is missing. 82 | 83 | ## 2.1.0 84 | 85 | ### Added 86 | 87 | - Support for providing a DSN string. 88 | - Support for configure MySQL database with "singleTransaction" and "ssl" 89 | 90 | ### Fixed 91 | 92 | - Issue with Symfony 3.2 where commands were private. 93 | - Issue with Symfony 3.2 because `scalarPrototype` was not defined. 94 | 95 | ## 2.0.0 96 | 97 | The 2.0.0 release is just a technical BC break. We removed all adapters from the 98 | composer.json. So you need to re-add the adapters you were using. 99 | 100 | ### Added 101 | 102 | - Added support for Symfony 4. 103 | - Added tests 104 | - Support for many storage names with the same type. 105 | - Added commands for backup and restore 106 | - Support for `ignoreTables` on MySQL databases. 107 | - Added config `output_file_prefix`. 108 | - Support for DropboxV2 109 | 110 | ### Changes 111 | 112 | - You have to `composer require` for the adapter you want to use. Nothing is included by default. 113 | - The storage and database type is case-sensitive. 114 | 115 | ### Removed 116 | 117 | - Support for Symfony < 2.7. 118 | 119 | ## 1.1.0 120 | 121 | Support for Symfony 3.1. 122 | 123 | ## 1.0.0 124 | 125 | First release. 126 | -------------------------------------------------------------------------------- /Command/BackupCommand.php: -------------------------------------------------------------------------------- 1 | 20 | */ 21 | class BackupCommand extends Command 22 | { 23 | protected static $defaultName = 'backup-manager:backup'; 24 | 25 | /** 26 | * @var Manager 27 | */ 28 | private $manager; 29 | 30 | /** 31 | * @var string 32 | */ 33 | private $filePrefix; 34 | 35 | /** 36 | * 37 | * @param Manager $manager 38 | * @param string $filePrefix 39 | */ 40 | public function __construct(Manager $manager, $filePrefix) 41 | { 42 | $this->manager = $manager; 43 | $this->filePrefix = $filePrefix; 44 | parent::__construct(); 45 | } 46 | 47 | 48 | protected function configure() 49 | { 50 | $this 51 | ->setName(self::$defaultName) 52 | ->setDescription('Starts a new backup.') 53 | ->addArgument('database', InputArgument::REQUIRED, 'What database configuration do you want to backup?') 54 | ->addArgument('destinations', InputArgument::IS_ARRAY, 'What storages do you want to upload the backup to? Must be array.') 55 | ->addOption('compression', 'c', InputOption::VALUE_OPTIONAL, 'How do you want to compress the file?', 'null') 56 | ->addOption('filename', 'name', InputOption::VALUE_OPTIONAL, 'A customized filename', null) 57 | ; 58 | } 59 | 60 | protected function execute(InputInterface $input, OutputInterface $output): int 61 | { 62 | if (null === $filename = $input->getOption('filename')) { 63 | $filename = $this->filePrefix.(new \DateTime())->format('Y-m-d_H-i-s'); 64 | } 65 | 66 | $destinations = []; 67 | foreach ($input->getArgument('destinations') as $name) { 68 | $destinations[] = new Destination($name, $filename); 69 | } 70 | 71 | $this->manager->makeBackup()->run($input->getArgument('database'), $destinations, $input->getOption('compression')); 72 | 73 | return Command::SUCCESS; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Command/RestoreCommand.php: -------------------------------------------------------------------------------- 1 | 20 | */ 21 | class RestoreCommand extends Command 22 | { 23 | protected static $defaultName = 'backup-manager:restore'; 24 | 25 | /** 26 | * @var Manager 27 | */ 28 | private $manager; 29 | 30 | /** 31 | * 32 | * @param Manager $manager 33 | */ 34 | public function __construct(Manager $manager) 35 | { 36 | $this->manager = $manager; 37 | parent::__construct(); 38 | } 39 | 40 | 41 | protected function configure() 42 | { 43 | $this 44 | ->setName(self::$defaultName) 45 | ->setDescription('Restore form backup.') 46 | ->addArgument('database', InputArgument::REQUIRED, 'What database configuration do you want to backup?') 47 | ->addArgument('destination', InputArgument::REQUIRED, 'What storage do you want to restore from?') 48 | ->addArgument('file_path', InputArgument::REQUIRED, 'Where on the storage is the file?') 49 | ->addOption('compression', 'c', InputOption::VALUE_OPTIONAL, 'What file compression is used?', 'null') 50 | ; 51 | } 52 | 53 | protected function execute(InputInterface $input, OutputInterface $output): int 54 | { 55 | $this->manager->makeRestore()->run( 56 | $input->getArgument('destination'), 57 | $input->getArgument('file_path'), 58 | $input->getArgument('database'), 59 | $input->getOption('compression') 60 | ); 61 | 62 | return Command::SUCCESS; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /DependencyInjection/BMBackupManagerExtension.php: -------------------------------------------------------------------------------- 1 | processConfiguration($configuration, $configs); 29 | 30 | $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); 31 | $loader->load('services.yml'); 32 | $config['storage'] = isset($config['storage']) ? $config['storage'] : []; 33 | $config['database'] = isset($config['database']) ? $config['database'] : []; 34 | $this->validateStorage($config['storage']); 35 | 36 | $managerIdMap = [ 37 | 'Local' => 'backup_manager.filesystems.local_filesystem', 38 | 'AwsS3' => 'backup_manager.filesystems.awss3_filesystem', 39 | 'B2' => 'backup_manager.filesystems.b2_filesystem', 40 | 'Rackspace' => 'backup_manager.filesystems.rackspace_filesystem', 41 | 'Dropbox' => 'backup_manager.filesystems.dropbox_filesystem', 42 | 'DropboxV2' => 'backup_manager.filesystems.dropbox_v2_filesystem', 43 | 'Ftp' => 'backup_manager.filesystems.ftp_filesystem', 44 | 'Sftp' => 'backup_manager.filesystems.sftp_filesystem', 45 | 'Gcs' => 'backup_manager.filesystems.gcs_filesystem', 46 | ]; 47 | 48 | $filesystemDef = $container->getDefinition('backup_manager.filesystems'); 49 | foreach ($config['storage'] as $storageKey => $storageConfig) { 50 | $filesystemDef->addMethodCall('add', [new Reference($managerIdMap[$storageConfig['type']])]); 51 | } 52 | 53 | $container->getDefinition('backup_manager.config_storage') 54 | ->replaceArgument(0, $config['storage']); 55 | 56 | $container->getDefinition('backup_manager.config_database') 57 | ->replaceArgument(0, $config['database']); 58 | 59 | if (isset($config['output_file_prefix'])) { 60 | $container->getDefinition('backup_manager.command.backup') 61 | ->replaceArgument(1, $config['output_file_prefix']); 62 | } 63 | } 64 | 65 | /** 66 | * We want to make sure the correct dependencies are installed for a storage. 67 | * @param array $config 68 | */ 69 | private function validateStorage(array $config) 70 | { 71 | $requirements = [ 72 | 'Local' => ['package'=>'league/flysystem:^1.0', 'test'=>Local::class], 73 | 'AwsS3' => ['package'=>'league/flysystem-aws-s3-v3:^1.0', 'test'=>AwsS3Adapter::class], 74 | 'B2' => ['package'=>'mhetreramesh/flysystem-backblaze:^1.0', 'test'=>BackblazeAdapter::class], 75 | 'Rackspace' => ['package'=>'league/flysystem-rackspace:^1.0', 'test'=>RackspaceAdapter::class], 76 | 'Dropbox' => ['package'=>'league/flysystem-dropbox:^1.0', 'test'=>DropboxAdapter::class], 77 | 'DropboxV2' => ['package'=>'srmklive/flysystem-dropbox-v2:^1.0', 'test'=>Dropbox2Adapter::class], 78 | 'Ftp' => ['package'=>'league/flysystem:^1.0', 'test'=>Ftp::class], 79 | 'Sftp' => ['package'=>'league/flysystem-sftp:^1.0', 'test'=>SftpAdapter::class], 80 | 'Gcs' => ['package' => 'superbalist/flysystem-google-storage:^6.0', 'test' => GoogleStorageAdapter::class], 81 | ]; 82 | 83 | foreach ($config as $key => $storageConfig) { 84 | $type = $storageConfig['type']; 85 | if (!class_exists($requirements[$type]['test'])) { 86 | throw new \LogicException(sprintf('To use the configuration key "%s" in "bm_backup_manager.storage.%s.type" you need to install "%s"', $type, $key, $requirements[$type]['package'])); 87 | } 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /DependencyInjection/Configuration.php: -------------------------------------------------------------------------------- 1 | getRootNode(); 19 | } else { 20 | // BC layer for symfony/config 4.1 and older 21 | $treeBuilder = new TreeBuilder(); 22 | $rootNode = $treeBuilder->root('bm_backup_manager'); 23 | } 24 | 25 | $rootNode 26 | ->children() 27 | ->variableNode('storage') 28 | ->validate() 29 | ->always(function ($storageConfig) { 30 | foreach ($storageConfig as $name => $config) { 31 | if (!isset($config['type'])) { 32 | throw new InvalidConfigurationException(sprintf('You must define a "type" for storage "%s"', $name)); 33 | } 34 | 35 | switch ($config['type']) { 36 | case 'Local': 37 | $this->validateAuthenticationType(['root'], $config, 'Local'); 38 | break; 39 | case 'AwsS3': 40 | $this->validateAuthenticationType(['key', 'secret', 'region', 'version', 'bucket', 'root', 'endpoint'], $config, 'AwsS3'); 41 | break; 42 | case 'B2': 43 | $this->validateAuthenticationType(['key', 'accountId', 'bucket'], $config, 'B2'); 44 | break; 45 | case 'Rackspace': 46 | $this->validateAuthenticationType(['username', 'password', 'container'], $config, 'Rackspace'); 47 | break; 48 | case 'Dropbox': 49 | $this->validateAuthenticationType(['token', 'key', 'secret', 'app', 'root'], $config, 'Dropbox'); 50 | break; 51 | case 'DropboxV2': 52 | $this->validateAuthenticationType(['token', 'root'], $config, 'DropboxV2'); 53 | break; 54 | case 'Ftp': 55 | $this->validateAuthenticationType(['host', 'username', 'password', 'root', 'port', 'passive', 'ssl', 'timeout'], $config, 'Ftp'); 56 | break; 57 | case 'Sftp': 58 | $this->validateAuthenticationType(['host', 'username', 'password', 'root', 'port', 'timeout', 'privateKey'], $config, 'Sftp'); 59 | break; 60 | case 'Gcs': 61 | $this->validateAuthenticationType(['project', 'keyFilePath', 'bucket', 'prefix'], $config, 'Gcs'); 62 | break; 63 | default: 64 | $validTypes = ['Local', 'AwsS3', 'B2', 'Rackspace', 'Dropbox', 'DropboxV2', 'Ftp', 'Sftp', 'Gcs']; 65 | throw new InvalidConfigurationException(sprintf('Type must be one of "%s", got "%s"', implode(', ', $validTypes), $config['type'])); 66 | } 67 | } 68 | 69 | return $storageConfig; 70 | }) 71 | ->end() 72 | 73 | ->end() // End storage 74 | 75 | ->arrayNode('database') 76 | ->validate() 77 | ->ifTrue(function ($databases) { 78 | $valid = true; 79 | foreach ($databases as $name => $d) { 80 | if (isset($d['dsn'])) { 81 | // We cannot resolve the DSN now. It might be a environment variable. 82 | continue; 83 | } 84 | if (empty($d['type'])) { 85 | throw new InvalidConfigurationException(sprintf('You must define a "type" or "dsn" for database "%s"', $name)); 86 | } 87 | if ($d['type'] !== 'mysql') { 88 | // If not "mysql" we have to make sure these parameter are set to default 89 | $valid = $valid && empty($d['ignoreTables']) && empty($d['ssl']) && empty($d['singleTransaction']); 90 | } 91 | } 92 | 93 | return !$valid; 94 | }) 95 | ->thenInvalid('Keys "ignoreTables", "ssl" and "singleTransaction" are only valid on MySQL databases.') 96 | ->end() 97 | ->validate() 98 | ->always(function ($databases) { 99 | foreach ($databases as &$database) { 100 | if (empty($database['ignoreTables'])) { 101 | unset($database['ignoreTables']); 102 | } 103 | } 104 | return $databases; 105 | }) 106 | ->end() 107 | ->prototype('array') 108 | ->children() 109 | ->scalarNode('type')->end() 110 | ->scalarNode('host')->end() 111 | ->scalarNode('port')->end() 112 | ->scalarNode('user')->end() 113 | ->scalarNode('pass')->end() 114 | ->scalarNode('database')->end() 115 | ->scalarNode('dsn')->end() 116 | ->booleanNode('singleTransaction')->end() 117 | ->booleanNode('ssl')->end() 118 | ->scalarNode('extraParams')->end() 119 | ->arrayNode('ignoreTables') 120 | ->prototype('scalar')->end() 121 | ->end() 122 | ->end() 123 | ->end() 124 | ->end() 125 | ->scalarNode('output_file_prefix')->info('Use as a prefix for default backup filename')->end() 126 | ->end() 127 | ; 128 | 129 | return $treeBuilder; 130 | } 131 | 132 | /** 133 | * Validate that the configuration fragment has the specified keys and none other. 134 | * 135 | * @param array $expected Fields that must exist 136 | * @param array $actual Actual configuration hashmap 137 | * @param string $typeName Name of storage type for error messages 138 | * 139 | * @throws InvalidConfigurationException If $actual does not have exactly the keys specified in $expected (plus 'type') 140 | */ 141 | private function validateAuthenticationType(array $expected, array $actual, $typeName) 142 | { 143 | unset($actual['type']); 144 | $actual = array_keys($actual); 145 | 146 | if (empty(array_diff($actual, $expected))) { 147 | return; 148 | } 149 | 150 | throw new InvalidConfigurationException(sprintf( 151 | 'Storage type "%s" received invalid key "%s". Please choose one of "%s".', 152 | $typeName, 153 | implode(', ', $expected), 154 | implode(', ', $actual) 155 | )); 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /Factory/ConfigFactory.php: -------------------------------------------------------------------------------- 1 | 12 | */ 13 | class ConfigFactory 14 | { 15 | /** 16 | * If a DSN is configured, then let it override other database storages. 17 | * @param array $config 18 | * @return Config 19 | */ 20 | public static function createConfig(array $config) 21 | { 22 | foreach ($config as $key => $databaseConfig) { 23 | if (isset($databaseConfig['dsn'])) { 24 | $dsn = DsnParser::parseUrl($databaseConfig['dsn']); 25 | $config[$key]['type'] = $dsn->getScheme(); 26 | $config[$key]['host'] = $dsn->getHost(); 27 | $config[$key]['port'] = $dsn->getPort(); 28 | $config[$key]['user'] = $dsn->getUser(); 29 | $config[$key]['pass'] = $dsn->getPassword(); 30 | if (null !== $path = $dsn->getPath()) { 31 | $path = ltrim($path, '/'); 32 | } 33 | 34 | $config[$key]['database'] = $path; 35 | unset($config[$key]['dsn']); 36 | } 37 | } 38 | 39 | return new Config($config); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | BackupManagerBundle 2 | =================== 3 | 4 | [![Latest Stable Version](https://poser.pugx.org/backup-manager/symfony/version.png)](https://packagist.org/packages/backup-manager/symfony) 5 | [![License](https://poser.pugx.org/backup-manager/symfony/license.png)](https://packagist.org/packages/backup-manager/symfony) 6 | [![Build Status](https://travis-ci.org/backup-manager/symfony.svg?branch=master)](https://travis-ci.org/backup-manager/symfony) 7 | [![Total Downloads](https://poser.pugx.org/backup-manager/symfony/downloads.png)](https://packagist.org/packages/backup-manager/symfony) 8 | 9 | A simple database backup manager for Symfony with support for S3, Rackspace, Dropbox, FTP, SFTP. 10 | 11 | This package pulls in the framework agnostic [Backup Manager](https://github.com/backup-manager/backup-manager) and provides seamless integration with **Symfony**. 12 | 13 | Installation 14 | ============ 15 | 16 | Step 1: Download the Bundle 17 | --------------------------- 18 | 19 | Open a command console, enter your project directory and execute the 20 | following command to download the latest stable version of this bundle: 21 | 22 | ```bash 23 | $ composer require backup-manager/symfony 24 | ``` 25 | 26 | This command requires you to have Composer installed globally, as explained 27 | in the [installation chapter](https://getcomposer.org/doc/00-intro.md) 28 | of the Composer documentation. 29 | 30 | Step 2 (with Flex): Enable the Bundle 31 | ------------------------------------- 32 | 33 | You do not need to do anything more. The bundle is enabled automatically and 34 | you have some nice default config in `config/packages/bm_backup_manager.yml`. 35 | 36 | Step 2 (no Flex): Enable the Bundle 37 | ----------------------------------- 38 | 39 | If you are not using Symfony Flex, you need to enable the bundle by adding it to 40 | the list of registered bundles in the `app/AppKernel.php` file of your project. 41 | 42 | ```php 43 | // config/bundles.php 44 | 45 | return [ 46 | BM\BackupManagerBundle\BMBackupManagerBundle::class => ['all' => true], 47 | // ... 48 | ]; 49 | 50 | ``` 51 | 52 | Step 3: Configure your databases and filesystems 53 | ------------------------------------------------ 54 | 55 | ```yaml 56 | # config/packages/bm_backup_manager.yml 57 | 58 | bm_backup_manager: 59 | database: 60 | development: 61 | type: mysql 62 | host: localhost 63 | port: 3306 64 | user: root 65 | pass: password 66 | database: test 67 | ignoreTables: ['foo', 'bar'] 68 | 69 | # If DSN is specified, it will override other values 70 | dsn: 'mysql://root:root_pass@127.0.0.1:3306/test_db' 71 | production: 72 | type: postgresql 73 | host: localhost 74 | port: 5432 75 | user: postgres 76 | pass: password 77 | database: test 78 | 79 | # You could also use a environment variable 80 | dsn: '%env(resolve:DATABASE_URL)%' 81 | storage: 82 | local: 83 | type: Local 84 | root: /path/to/working/directory 85 | s3: 86 | type: AwsS3 87 | key: 88 | secret: 89 | region: us-east-1 90 | version: latest 91 | bucket: 92 | root: 93 | b2: 94 | type: B2 95 | key: 96 | accountId: 97 | bucket: 98 | rackspace: 99 | type: Rackspace 100 | username: 101 | password: 102 | container: 103 | dropbox: 104 | type: DropboxV2 105 | token: 106 | key: 107 | secret: 108 | app: 109 | root: 110 | ftp: 111 | type: Ftp 112 | host: 113 | username: 114 | password: 115 | root: 116 | port: 21 117 | passive: true 118 | ssl: true 119 | timeout: 30 120 | sftp: 121 | type: Sftp 122 | host: 123 | username: 124 | password: 125 | root: 126 | port: 21 127 | timeout: 10 128 | privateKey: 129 | ``` 130 | 131 | Usage 132 | ===== 133 | 134 | To backup from any configured database. 135 | ------------------------------------------------- 136 | 137 | 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. 138 | 139 | ```php 140 | class Foo { 141 | private $backupManager; 142 | 143 | public function __construct(BackupManager $backupManager) { 144 | $this->backupManager = $backupManager; 145 | } 146 | 147 | public function bar() { 148 | $this->backupManager->makeBackup()->run('development', [new Destination('s3', 'test/backup.sql')], 'gzip'); 149 | } 150 | } 151 | ``` 152 | 153 | Or with a command: 154 | 155 | ```bash 156 | php bin/console backup-manager:backup development s3 -c gzip --filename test/backup.sql 157 | ``` 158 | 159 | To restore from any configured filesystem. 160 | --------------------------------------------------- 161 | 162 | Restore the database file `test/backup.sql.gz` from `Amazon S3` to the `development` database. 163 | 164 | ```php 165 | class Foo { 166 | private $backupManager; 167 | 168 | public function __construct(BackupManager $backupManager) { 169 | $this->backupManager = $backupManager; 170 | } 171 | 172 | public function bar() { 173 | $this->backupManager->makeRestore()->run('s3', 'test/backup.sql.gz', 'development', 'gzip'); 174 | } 175 | } 176 | ``` 177 | 178 | Or with a command: 179 | 180 | ```bash 181 | php bin/console backup-manager:restore development s3 test/backup.sql.gz -c gzip 182 | ``` 183 | 184 | > This package does not allow you to backup from one database type and restore to another. A MySQL dump is not compatible with PostgreSQL. 185 | 186 | Requirements 187 | ============ 188 | 189 | - PHP 7.3 190 | - MySQL support requires `mysqldump` and `mysql` command-line binaries 191 | - PostgreSQL support requires `pg_dump` and `psql` command-line binaries 192 | - Gzip support requires `gzip` and `gunzip` command-line binaries 193 | -------------------------------------------------------------------------------- /Resources/config/services.yml: -------------------------------------------------------------------------------- 1 | services: 2 | # Commands 3 | backup_manager.command.backup: 4 | class: BM\BackupManagerBundle\Command\BackupCommand 5 | arguments: ['@backup_manager', ''] 6 | tags: 7 | - { name: 'console.command' } 8 | 9 | backup_manager.command.restore: 10 | class: BM\BackupManagerBundle\Command\RestoreCommand 11 | arguments: ['@backup_manager'] 12 | tags: 13 | - { name: 'console.command' } 14 | 15 | # Storage 16 | backup_manager.config_storage: 17 | class: BackupManager\Config\Config 18 | arguments: [[]] 19 | public: false 20 | 21 | backup_manager.filesystems.awss3_filesystem: 22 | class: BackupManager\Filesystems\Awss3Filesystem 23 | public: false 24 | 25 | backup_manager.filesystems.b2_filesystem: 26 | class: BackupManager\Filesystems\BackblazeFilesystem 27 | public: false 28 | 29 | backup_manager.filesystems.dropbox_filesystem: 30 | class: BackupManager\Filesystems\DropboxFilesystem 31 | public: false 32 | 33 | backup_manager.filesystems.dropbox_v2_filesystem: 34 | class: BackupManager\Filesystems\DropboxV2Filesystem 35 | public: false 36 | 37 | backup_manager.filesystems.ftp_filesystem: 38 | class: BackupManager\Filesystems\FtpFilesystem 39 | public: false 40 | 41 | backup_manager.filesystems.local_filesystem: 42 | class: BackupManager\Filesystems\LocalFilesystem 43 | public: false 44 | 45 | backup_manager.filesystems.rackspace_filesystem: 46 | class: BackupManager\Filesystems\RackspaceFilesystem 47 | public: false 48 | 49 | backup_manager.filesystems.sftp_filesystem: 50 | class: BackupManager\Filesystems\SftpFilesystem 51 | public: false 52 | 53 | backup_manager.filesystems.gcs_filesystem: 54 | class: BackupManager\Filesystems\GcsFilesystem 55 | public: false 56 | 57 | backup_manager.filesystems: 58 | class: BackupManager\Filesystems\FilesystemProvider 59 | public: false 60 | arguments: ["@backup_manager.config_storage"] 61 | 62 | # Database 63 | backup_manager.config_database: 64 | class: BackupManager\Config\Config 65 | factory: 'BM\BackupManagerBundle\Factory\ConfigFactory::createConfig' 66 | arguments: [[]] 67 | public: false 68 | 69 | backup_manager.databases.mysql_database: 70 | class: BackupManager\Databases\MysqlDatabase 71 | public: false 72 | 73 | backup_manager.databases.postgresql_database: 74 | class: BackupManager\Databases\PostgresqlDatabase 75 | public: false 76 | 77 | backup_manager.databases: 78 | class: BackupManager\Databases\DatabaseProvider 79 | public: false 80 | arguments: ["@backup_manager.config_database"] 81 | calls: 82 | - [add, ["@backup_manager.databases.mysql_database"]] 83 | - [add, ["@backup_manager.databases.postgresql_database"]] 84 | 85 | # Compressor 86 | backup_manager.compressors.gzip_compressor: 87 | class: BackupManager\Compressors\GzipCompressor 88 | public: false 89 | 90 | backup_manager.compressors.null_compressor: 91 | class: BackupManager\Compressors\NullCompressor 92 | public: false 93 | 94 | backup_manager.compressors: 95 | class: BackupManager\Compressors\CompressorProvider 96 | public: false 97 | calls: 98 | - [add, ["@backup_manager.compressors.gzip_compressor"]] 99 | - [add, ["@backup_manager.compressors.null_compressor"]] 100 | 101 | # Manager 102 | backup_manager: 103 | class: BackupManager\Manager 104 | arguments: ["@backup_manager.filesystems", "@backup_manager.databases", "@backup_manager.compressors"] 105 | 106 | # Add alias for autowriring 107 | BackupManager\Manager: '@backup_manager' 108 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "backup-manager/symfony", 3 | "description": "A simple database backup manager for Symfony2 with support for S3, Rackspace, Dropbox, FTP, SFTP.", 4 | "keywords": ["database","backup","Symfony","S3","Rackspace","Dropbox","FTP","SFTP"], 5 | "type": "symfony-bundle", 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "Tobias Nyholm", 10 | "email": "tobias.nyholm@gmail.com" 11 | }, 12 | { 13 | "name": "Luiz Henrique Gomes Palácio", 14 | "email": "lhpalacio@outlook.com" 15 | } 16 | ], 17 | "require": { 18 | "php": "^7.3 || ^8.0", 19 | "backup-manager/backup-manager": "^3.0", 20 | "nyholm/dsn": "^2.0", 21 | "symfony/config": "^3.4 || ^4.4 || ^5.0 || ^6.0", 22 | "symfony/console": "^3.4 || ^4.4 || ^5.0 || ^6.0", 23 | "symfony/dependency-injection": "^3.4 || ^4.4 || ^5.0 || ^6.0", 24 | "symfony/filesystem": "^3.4 || ^4.4 || ^5.0 || ^6.0", 25 | "symfony/framework-bundle": "^3.4 || ^4.4 || ^5.0 || ^6.0", 26 | "symfony/http-kernel": "^3.4 || ^4.4 || ^5.0 || ^6.0", 27 | "symfony/yaml": "^3.4 || ^4.4 || ^5.0 || ^6.0" 28 | }, 29 | "require-dev": { 30 | "matthiasnoback/symfony-dependency-injection-test": "^4.1", 31 | "matthiasnoback/symfony-config-test": "^4.1", 32 | "nyholm/symfony-bundle-test": "^1.6", 33 | "superbalist/flysystem-google-storage": "^6.0 || ^7.0", 34 | "symfony/phpunit-bridge": "^5.0" 35 | }, 36 | "suggest": { 37 | "league/flysystem-aws-s3-v3": "To use AWS S3, version 3", 38 | "mhetreramesh/flysystem-backblaze": "To use B2", 39 | "srmklive/flysystem-dropbox-v2": "To use Dropbox", 40 | "superbalist/flysystem-google-storage": "Google Cloud Storage adapter support.", 41 | "league/flysystem-rackspace": "To use Rackspace", 42 | "league/flysystem-sftp": "To use sftp" 43 | }, 44 | "autoload": { 45 | "psr-4": { "BM\\BackupManagerBundle\\": "" } 46 | }, 47 | "scripts": { 48 | "test": "vendor/bin/simple-phpunit", 49 | "test-ci": "vendor/bin/simple-phpunit --coverage-text --coverage-clover=build/coverage.xml" 50 | }, 51 | "config": { 52 | "sort-packages": true 53 | }, 54 | "extra": { 55 | "branch-alias": { 56 | "dev-master": "3.2-dev" 57 | } 58 | } 59 | } 60 | --------------------------------------------------------------------------------