PHP code example of dutchie027 / easymysqlbackup

1. Go to this page and download the library: Download dutchie027/easymysqlbackup 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/ */

    

dutchie027 / easymysqlbackup example snippets

 php
#!/usr/bin/php


Backup\Backup;

# OPTION A: Create a new backup with "default" configuration set
$backup = new Backup();

# OPTION B: Create a configuration set using an .ini file
$backup = new Backup('/path/to/my.ini');

# Backup the database named "test". The location on the file system will be returned
$backup_file = $backup->createLocalBackup("test");
 php
#!/usr/bin/php


Backup\Backup;

# OPTION A: Create a new backup with "default" configuration set
$backup = new Backup();

# Restore the file '/backups/mydb.20220330162457.sql.gz' to the database named 'restoredb'
# Also, force the database to be dropped & recreated
$backup->restore()->restoreLocalBackup('/backups/mydb.20220330162457.sql.gz', 'restoredb', 1);