barygi / phpbu-laravel
Laravel backup package - integrates phpbu with the laravel artisan command line tool
4.0.1
2020-11-20 13:55 UTC
Requires
- illuminate/console: 5.*|6.*|7.*|8.*
- illuminate/support: 5.*|6.*|7.*|8.*
- phpbu/phpbu: ~6
This package is not auto-updated.
Last update: 2024-11-17 06:42:51 UTC
README
Laravel backup package - integrates phpbu with the laravel artisan command line tool.
A more detailed documentation can be found in the phpbu manual.
Features
- Creating backups
- Directories
- MySQL
- Validate backups
- Check min size
- Comparing with previous backups
- Sync backups to other locations
- All Laravel filesystems
- Cleanup your backup location
- Delete backups older x
- Store only x MB of backups
- Keep only last x backups
Requirements
- PHP 7.0
- Laravel 5.*
- phpbu 5.*
- see phpbu requirements for more details
Installation
Use composer to install the package.
composer require phpbu/phpbu-laravel
Add the package ServiceProvider to your config/app.php
configuration file.
'providers' => [ ... /* * phpbu Backup Service Providers... */ phpbu\Laravel\ServiceProvider::class, ];
Finally create a configuration skeleton by publishing the package.
php artisan vendor:publish --provider="phpbu\Laravel\ServiceProvider"
Configuration
After publishing the ServiceProvider
a phpbu.php
configuration file is created in your config
directory.
<?php return [ /* |-------------------------------------------------------------------------- | laravel configuration |-------------------------------------------------------------------------- | | This is activated as long as you don't specify a phpbu | configuration file at the bottom. | */ // no directories to backup // keep at least the empty array 'directories' => [] 'directories' => [ [ 'source' => [ 'path' => storage_path('app'), 'options' => [], ], 'target' => [ 'dirname' => storage_path('/backup/app'), 'filename' => 'app-%Y%m%d-%H%i.tar', 'compression' => 'bzip2', ], 'sync' => [ 'filesystem' => 's3', 'path' => '/backup/app', ] ] ], // no databases to backup // keep at least the empty array 'databases' => [] 'databases' => [ [ 'source' => [ 'connection' => 'mysql', 'options' => [] ], 'target' => [ 'dirname' => storage_path('backup/db'), 'filename' => 'dump-%Y%m%d-%H%i.sql', 'compression' => 'bzip2', ], 'sync' => [ 'filesystem' => 's3', 'path' => '/backup/db', ] ], ], 'config' => __FILE__, /* |-------------------------------------------------------------------------- | phpbu configuration |-------------------------------------------------------------------------- | | Path to a phpbu configuration file. | You can use a phpbu.xml or phpbu.json configuration. | If you use one of those the configuration above will be ignored. | This is deactivated by default so you can setup your backup using | the configuration above */ 'phpbu' => null, ];
Usage
Show command help information.
php artisan phpbu:backup --help
Execute the backup,
php artisan phpbu:backup
Execute a dry-run without making any changes.
php artisan phpbu:backup --phpbu-simulate