PHP code example of raffaelecarelle / symfony-pro-backup-bundle
1. Go to this page and download the library: Download raffaelecarelle/symfony-pro-backup-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
raffaelecarelle / symfony-pro-backup-bundle example snippets
use ProBackupBundle\Model\BackupConfiguration;
use ProBackupBundle\Manager\BackupManager;
// Create a backup
$config = (new BackupConfiguration())
->setType('database')
->setName('my_backup');
$backupManager = $container->get(BackupManager::class);
$result = $backupManager->backup($config);
if ($result->isSuccess()) {
echo 'Backup created: ' . $result->getFilePath();
} else {
echo 'Backup failed: ' . $result->getError();
}
// Restore a backup
$backupId = 'backup_123';
$success = $backupManager->restore($backupId, []);
if ($success) {
echo 'Backup restored successfully';
} else {
echo 'Restore failed';
}
bash
php bin/console pro:backup:create --type=database
bash
php bin/console pro:backup:restore <backup-id>
bash
php bin/console pro:backup:list