1. Go to this page and download the library: Download phil/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/ */
phil / backup example snippets
use Phil\Backup\Backups;
use Phil\Backup\Database\PostgresqlClient;
use Phil\Backup\Encryption\BackupCipher;
use Phil\Backup\Encryption\BackupKey;
use Phil\Backup\Media\MediaArchive;
use Phil\Backup\Rotation\RotationPolicy;
use Phil\Backup\Storage\BackupDirectory;
$backups = new Backups(
new PostgresqlClient('shop', ['host' => 'db.internal', 'user' => 'shop', 'password' => $password], $runner),
new BackupDirectory('/var/backups/shop'),
new BackupCipher(BackupKey::fromBase64($key)),
new MediaArchive(['uploads' => '/srv/shop/public/uploads']),
new RotationPolicy(last: 3, daily: 7, weekly: 4, monthly: 12),
);
$set = $backups->create(new DateTimeImmutable()); // shop-20261107-031500.dump.enc and .media.tar.enc
$backups->prune(); // the sets the rotation has expired
$backups->verify($set, 'shop_restore_test'); // restored into the scratch database and checked
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.