Create database backup to dropbox in Laravel 5:
For creating a database backup ,
Firstly you'll in need of pull the package through command line:
composer require backup-manager/laravel
Now we will need of pull dropbox adapter
composer require league/flysystem-dropbox
Now goto config/app.php this file & write this in providers
BackupManager\Laravel\Laravel5ServiceProvider::class,
And then publish the storage configuration file:
php artisan vendor:publish --provider="BackupManager\Laravel\Laravel5ServiceProvider"
Now Create a dropbox API
For creating this, select dropbox api app as shown in image, then select 'yes' in drop box & enter application name and create app.
Now in setting page you can see app key and app secret. Also genrate a access token on this page.
Now goto backup-manager.php file and add the below content.
'dropbox' => [
'type' => 'Dropbox',
'token' => 'your-token-here',
'key' => 'your-key-here',
'secret' => 'your-secret-here',
'app' => 'your-app-name',
'root' => '/backups',
],
It will store backup in backups folder
For testing this on your app, run this command on your terminal
php artisan db:backup --database=mysql --destination=dropbox --destinationPath=`date +\%s`-laravel4.sql --compression=null
To check the file in dropbox, go to app folder.
Thanks
For creating a database backup ,
Firstly you'll in need of pull the package through command line:
composer require backup-manager/laravel
Now we will need of pull dropbox adapter
composer require league/flysystem-dropbox
Now goto config/app.php this file & write this in providers
BackupManager\Laravel\Laravel5ServiceProvider::class,
And then publish the storage configuration file:
php artisan vendor:publish --provider="BackupManager\Laravel\Laravel5ServiceProvider"
Now Create a dropbox API
For creating this, select dropbox api app as shown in image, then select 'yes' in drop box & enter application name and create app.
Now in setting page you can see app key and app secret. Also genrate a access token on this page.
Now goto backup-manager.php file and add the below content.
'dropbox' => [
'type' => 'Dropbox',
'token' => 'your-token-here',
'key' => 'your-key-here',
'secret' => 'your-secret-here',
'app' => 'your-app-name',
'root' => '/backups',
],
It will store backup in backups folder
For testing this on your app, run this command on your terminal
php artisan db:backup --database=mysql --destination=dropbox --destinationPath=`date +\%s`-laravel4.sql --compression=null
To check the file in dropbox, go to app folder.
Thanks
No comments:
Post a Comment