PHP code example of programinglive / laravel-simple-backup

1. Go to this page and download the library: Download programinglive/laravel-simple-backup 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/ */

    

programinglive / laravel-simple-backup example snippets


use ProgrammingLive\LaravelSimpleBackup\BackupManager;

// Backup the default connection
$filepath = BackupManager::backup();

// Backup a specific connection
$filepath = BackupManager::backup('mysql');

// Get all backups
$backups = BackupManager::getBackups();

// Delete a backup
BackupManager::deleteBackup('backup_mydb_2024-12-08_10-30-45.sql');

// Download a backup
$filepath = BackupManager::downloadBackup('backup_mydb_2024-12-08_10-30-45.sql');

use ProgrammingLive\LaravelSimpleBackup\Facades\Backup;

// Backup the database
$filepath = Backup::backup();

// Get all backups
$backups = Backup::getBackups();
bash
php artisan vendor:publish --provider="ProgrammingLive\LaravelSimpleBackup\LaravelSimpleBackupServiceProvider" --tag="backup-config"
bash
php artisan backup:database
bash
php artisan backup:database --connection=mysql
bash
php artisan backup:database --connection=pgsql

backup_myapp_2024-12-08_10-30-45.sql
bash
   php artisan backup:database