juanchosl / backups
Little methods collection in order to create distincts type of backups
dev-master
2024-12-27 00:54 UTC
Requires
- php: ^7.1 || ^8.0
- juanchosl/exceptions: 1.0.*
- juanchosl/terminal: dev-master
- psr/log: ^3.0
Requires (Dev)
- juanchosl/logger: 1.1.*
- phpstan/phpstan: 1.12.*
- phpunit/phpunit: 9.6.*
Suggests
- ext-bz2: *
- ext-zip: *
This package is auto-updated.
Last update: 2025-05-27 01:51:21 UTC
README
Description
Little methods collection in order to create distincts type of backups
Install
composer require juanchosl/backups
Packagers
First, you need to select the desired final file type in order to backup your files and folders, can use:
- ZipRepository
- TarRepository
- PharRepository
Compression
Aditionally, we have available some compression systems in order to use with other needs
- Bzip
- Gzip
- Lzf
- Deflate
Strategies
The Backup library, can rename the result file in order to mantain some copies, we can use
- Datetime in format YYYYmmddHHiiss
- Incremental number from 1 to N
- Rotate number, from 1 to N and restart from 1
How to use
use JuanchoSL\Backups\Strategies\BackupNumIncremental; use JuanchoSL\Backups\Engines\Packagers\ZipEngine; $parent = dirname(__DIR__, 1); $obj = new BackupNumIncremental() $obj->setNumBackups(2) ->setEngine(new ZipEngine()) ->setDestinationFolder($parent . DIRECTORY_SEPARATOR . 'backups') ->addExcludedDir($parent . DIRECTORY_SEPARATOR . 'backups') ->addExcludedDir($parent . DIRECTORY_SEPARATOR . 'vendor'); $obj->pack($parent);