Here's my standard setup I use to backup data to my Dropbox account. This post is also made as a note for my self. So I don't forget in the furture.

Step 1:

composer require spatie/flysystem-dropbox
php artisan make:provider DropboxServiceProvider
Go to Laravel Application 

Open file: DropboxServiceProvider.php and paste below.

use Storage;
use League\Flysystem\Filesystem;
use Spatie\Dropbox\Client as DropboxClient;
use Spatie\FlysystemDropbox\DropboxAdapter;

In boot function paste.

Storage::extend('dropbox', function ($app, $config) {
   $client = new DropboxClient(
    return new Filesystem(new DropboxAdapter($client));

Now open app.php in config to register Dropbox service (In providers)


Next open filesystem.php and add.

'dropbox' => [
   'driver' => 'dropbox',
   'authorization_token' => env('DROPBOX_AUTH_TOKEN'),

Step 2: Install laravel-backup from Spatie

composer require spatie/laravel-backup
php artisan vendor:publish --provider="Spatie\Backup\BackupServiceProvider"

Open database.php (Code below is for local-test and on Windows 10. Uncomment dump_binary_path for production site).

'dump' => [
   //'dump_binary_path' => '/usr/bin/', // LIVE 
   'dump_binary_path' => env('BACKUP_MYSQL_DUMP', 'C:\Program Files\MySQL\MySQL Server 8.0\bin'), // LOCAL 
   'timeout' => 60 * 10,

Now open backup.php and adjust settings for your own configurations. Below is my setup.

'destination' => [
'name' => env('BACKUP_NAME', 'backup'),
filename_prefix = 'engbjerg_'
disks => ['

In order to make above work we have to enter some information in .env file.


# BACKUP_MYSQL_DUMP="C:\Program Files\MySQL\MySQL Server 8.0\bin" #Local: Windows 10. Live settings could be:  /usr/bin/ 

Schedule cron job to run backup. (My backup runs every sunday)


Step 3: Dropbox token

First you need to login on your Dropbox account. Click on the Create app button. Next step, you will be asked for choosing an API. Choose Scoped access. In the type of access choose App folder and give the name to your app/folder.

  1. Create an account on Dropbox / 2. Go to App console .

After creating an app, You'll be redirected to a page where you can generate access token. After clicking Generate, copy token value and define the constant DROPBOX_AUTH_TOKEN in the .env file.

That's it. We're done with the required setup to backup our Laravel project to Dropbox. Let's try to run our first backup. Open terminal in your project root dir and run command.

php artisan backup:run
Check status in terminal

That's it 👏