productshake / backup
Pre-configured Laravel backup solution with Dropbox integration
1.0.7
2025-05-30 16:38 UTC
Requires
- php: ^8.2
- ext-zip: *
- laravel/slack-notification-channel: ^3.5
- spatie/flysystem-dropbox: ^3.0
- spatie/laravel-backup: ^9.0
Requires (Dev)
- composer/composer: ^2.0
README
A pre-configured Laravel backup solution with Dropbox integration, built on top of spatie/laravel-backup.
Features
- Automatic Dropbox integration with token refresh
- Pre-configured backup settings
- Slack notifications
- Zero configuration needed in your Laravel project
- Automatic service provider registration
- Automatic task scheduling
Requirements
- PHP 8.2 or higher
- Laravel 11.x
- Dropbox account with API access
Installation
- Add the following environment variables to your
.env
file:
# REQUIRED ENVIRONMENT VARIABLES # # MAKE SURE TO ADD THESE VARIABLES TO YOUR .env FILE BEFORE PROCEEDING # SLACK_BOT_USER_OAUTH_TOKEN="" # Required - for Slack notifications HEALTH_SLACK_WEBHOOK_URL="your_webhook_url" # Optional - for Slack notifications SLACK_BOT_USER_DEFAULT_CHANNEL="#general" BACKUP_DIRECTORY_NAME="backups" # Directory name in Dropbox BACKUP_PREFIX_NAME="your_site_name" # Prefix for backup files (e.g., "mysite") BACKUP_MYSQL_DUMP="/usr/bin/" # Path to MySQL dump binary DROPBOX_KEY="your_key" # Dropbox app key DROPBOX_SECRET="your_secret" # Dropbox app secret DROPBOX_AUTH_TOKEN="your_token" # Dropbox OAuth token DROPBOX_REFRESH_TOKEN="your_refresh_token" # Dropbox refresh token DROPBOX_TOKEN_URL="https://${DROPBOX_KEY}:${DROPBOX_SECRET}@api.dropbox.com/oauth2/token" BACKUP_NOTIFICATION_EMAIL=hi@productshake.com # Optional - for email notifications
- Install the package via Composer:
composer require productshake/backup
That's it! The package will automatically:
- Configure the Dropbox filesystem driver
- Set up backup settings
- Handle token refresh
- Configure notifications
- Schedule backup tasks:
- Daily backup at 01:00
- Clean old backups at 02:00
- Monitor backup health at 03:00
Usage
Creating a Backup
php artisan backup:run
Listing Backups
php artisan backup:list
Cleaning Old Backups
php artisan backup:clean
Monitoring Backup Health
php artisan backup:monitor
Logs
Backup logs are automatically stored in:
storage/logs/backup.log
storage/logs/backup-clean.log
storage/logs/backup-monitor.log
Dropbox Setup Guide
- Go to Dropbox Developer Console
- Create a new app
- Generate an OAuth 2 refresh token:
https://www.dropbox.com/oauth2/authorize?client_id=YOUR_APP_KEY&response_type=code&token_access_type=offline
- Exchange the code for refresh token:
curl https://api.dropbox.com/oauth2/token \ -d code=YOUR_AUTH_CODE \ -d grant_type=authorization_code \ -u YOUR_APP_KEY:YOUR_APP_SECRET
Configuration
The package comes pre-configured, but you can publish the config file if you need to customize it:
php artisan vendor:publish --tag="backup-config"
Credits
- Spatie for their excellent Laravel Backup package
- ProductShake
License
The MIT License (MIT). Please see License File for more information.