1. Go to this page and download the library: Download sapistudio/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/ */
sapistudio / backup example snippets
use SapiStudio\Backup\Handler;
$bkHandler = Handler::create('/tmp/backups');// set up your backup folder location
$bkHandler->setMaxFileSize(5)//maximum filesize in Mb to be added to backup,skip it will add all files
->setAllowedExtensions(['php'])//desired extensions to backup,skip it will add all files
->includeFilesFrom(['/'])//the main directories to backup,as array . full path
$bkHandler->createBackup();// only runs from cli
$bkHandler->listBackups();
// this is the default config,you do not have to passed it if you dont change it
$cleanupConfig = [
'numberOfBackupsPerPeriod' => 0,/** The number of backups must be kept on period. */
'keepDailyBackupsForDays' => 16,/** The number of days for which all daily backups must be kept.*/
'keepWeeklyBackupsForWeeks' => 8,/** The number of weeks for which all one weekly backup must be kept.*/
'keepMonthlyBackupsForMonths' => 4,/** The number of months for which one monthly backup must be kept.*/
'deleteOldestBackupsWhenUsingMoreMegabytesThan' => 5000,/** After cleaning up backups, remove the oldest backup until this number of megabytes has been reached.*/
];
$bkHandler->cleanupBackups($cleanupConfig);// only runs from cli
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.