Package Data | |
---|---|
Maintainer Username: | ShawnMcCool |
Maintainer Contact: | shawn@heybigname.com (Shawn McCool) |
Package Create Date: | 2015-06-09 |
Package Last Update: | 2021-02-03 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-17 03:04:30 |
Package Statistics | |
---|---|
Total Downloads: | 757,153 |
Monthly Downloads: | 1,651 |
Daily Downloads: | 12 |
Total Stars: | 655 |
Total Watchers: | 32 |
Total Forks: | 149 |
Total Open Issues: | 23 |
This package pulls in the framework agnostic Backup Manager and provides seamless integration with Laravel.
Watch a video tour to get an idea what is possible with this package.
Note: This package is for Laravel integration only. For information about the framework-agnostic core package (or the Symfony driver) please see the base package repository.
It's stable enough, you'll need to understand filesystem permissions.
This package is actively being developed and we would like to get feedback to improve it. Please feel free to submit feedback.
mysqldump
and mysql
command-line binariespg_dump
and psql
command-line binariesgzip
and gunzip
command-line binariesComposer
Run the following to include this via Composer
composer require backup-manager/laravel
Then, you'll need to select the appropriate packages for the adapters that you want to use.
# to support s3 or google cs
composer require league/flysystem-aws-s3-v3
# to support dropbox
composer require srmklive/flysystem-dropbox-v2
# to support rackspace
composer require league/flysystem-rackspace
# to support sftp
composer require league/flysystem-sftp
To install into a Laravel 4 project, first do the composer install then add the following class to your config/app.php service providers list.
BackupManager\Laravel\Laravel4ServiceProvider::class,
Copy the vendor/backup-manager/laravel/config/backup-manager.php
file to app/config/backup-manager.php
and configure it to suit your needs.
To install into a Laravel project, first do the composer install then add *ONE *of the following classes to your config/app.php service providers list.
// FOR LARAVEL 5.0 ONLY
BackupManager\Laravel\Laravel50ServiceProvider::class,
// FOR LARAVEL 5.1 - 5.4
BackupManager\Laravel\Laravel5ServiceProvider::class,
// FOR LARAVEL 5.5
BackupManager\Laravel\Laravel55ServiceProvider::class,
Publish the storage configuration file.
php artisan vendor:publish --provider="BackupManager\Laravel\Laravel5ServiceProvider"
The Backup Manager will make use of Laravel's database configuration. But, it won't know about any connections that might be tied to other environments, so it can be best to just list multiple connections in the config/database.php
file.
To install into a Lumen project, first do the composer install then add the configuration file loader and ONE of the following service providers to your bootstrap/app.php
.
// FOR LUMEN 5.0 ONLY
$app->configure('backup-manager');
$app->register(BackupManager\Laravel\Lumen50ServiceProvider::class);
// FOR LUMEN 5.1 - 5.4
$app->configure('backup-manager');
$app->register(BackupManager\Laravel\LumenServiceProvider::class);
// FOR LUMEN 5.5 AND ABOVE
$app->configure('backup-manager');
$app->register(BackupManager\Laravel\Lumen55ServiceProvider::class);
Copy the vendor/backup-manager/laravel/config/backup-manager.php
file to config/backup-manager.php
and configure it to suit your needs.
IoC Resolution
BackupManager\Manager
can be automatically resolved through constructor injection thanks to Laravel's IoC container.
use BackupManager\Manager;
public function __construct(Manager $manager) {
$this->manager = $manager;
}
It can also be resolved manually from the container.
$manager = App::make(\BackupManager\Manager::class);
Artisan Commands
There are three commands available db:backup
, db:restore
and db:list
.
All will prompt you with simple questions to successfully execute the command.
Example Command for 24hour scheduled cronjob
php artisan db:backup --database=mysql --destination=dropbox --destinationPath=project --timestamp="d-m-Y" --compression=gzip
This command will backup your database to dropbox using mysql and gzip compresion in path /backups/project/DATE.gz (ex: /backups/project/31-7-2015.gz)
It's possible to schedule backups using Laravel's scheduler.
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule) {
$environment = config('app.env');
$schedule->command(
"db:backup --database=mysql --destination=s3 --destinationPath=/{$environment}/projectname --timestamp="Y_m_d_H_i_s" --compression=gzip"
)->twiceDaily(13,21);
}
We recommend using the vagrant configuration supplied with this package for development and contribution. Simply install VirtualBox, Vagrant, and Ansible then run vagrant up
in the root folder. A virtualmachine specifically designed for development of the package will be built and launched for you.
When contributing please consider the following guidelines:
if ( ! is_null(...)) {
.Interface
, Traits should NOT be suffixed with Trait
.This package is maintained by Shawn McCool and Mitchell van Wijngaarden.
This package is licensed under the MIT license.