1. Go to this page and download the library: Download fezfez/backup-manager 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/ */
fezfez / backup-manager example snippets
$local = new \League\Flysystem\Adapter\Local(getcwd() . '/data/');
$webdav = new \League\Flysystem\WebDAV\WebDAVAdapter(new \Sabre\DAV\Client([
'baseUri' => getenv('WEBDAV_HOST'),
'userName' => getenv('WEBDAV_username'),
'password' => getenv('WEBDAV_password'),
]), 'remote.php/webdav/');
$manager = \Fezfez\BackupManager\BackupManager::create();
$manager->backup(
new LeagueFilesystemAdapaterV1($local),
new \Fezfez\BacpkupManager\Databases\MysqlDatabase(
getenv('DB_HOST'),
getenv('DB_PORT'),
getenv('DB_USER'),
getenv('DB_PASSWORD'),
getenv('DB_DATABASE')
),
[
new \Fezfez\BackupManager\Filesystems\Destination(new LeagueFilesystemAdapaterV1($webdav), 'test/backup.sql')
],
\Fezfez\BackupManager\Compressors\GzipCompressor::create()
);
$manager->restore(
new LeagueFilesystemAdapaterV1($local),
new LeagueFilesystemAdapaterV1($webdav),
'test/backup.sql',
new \Fezfez\BacpkupManager\Databases\MysqlDatabase(
getenv('DB_HOST'),
getenv('DB_PORT'),
getenv('DB_USER'),
getenv('DB_PASSWORD'),
getenv('DB_DATABASE')
),
\Fezfez\BackupManager\Compressors\GzipCompressor::create()
);