1. Go to this page and download the library: Download lily-labs/db-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/ */
lily-labs / db-backup example snippets
use LilyLabs\DBBackup\BasicBackupFileNameGenerator;
use LilyLabs\DBBackup\MysqldumpBackupProcessor;
$db_name = "DBTest";
$date = new DateTime('now');
$filename_generator = new BasicBackupFileNameGenerator($db_name, $date);
$filename = $filename_generator->getName(); // DBTest_[year]-[month]-[day].sql
$backup_processor = new MysqldumpBackupProcessor(
$db_name,
$filename_generator
);
$backup_file = $backup_processor->execute();