Download the PHP package avcodewizard/laravel-backup without Composer
On this page you can find all versions of the php package avcodewizard/laravel-backup. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download avcodewizard/laravel-backup
More information about avcodewizard/laravel-backup
Files in avcodewizard/laravel-backup
Package laravel-backup
Short Description A Laravel package for database and storage backup with auto-cleanup.
License MIT
Informations about the package laravel-backup
๐ฆ Laravel Backup Package
A simple Laravel package to automatically backup your database and storage directory to multiple destinations (Local, Amazon S3, Google Drive), with a Blade-based UI to view, download, and delete backups.
๐ Features
- ๐ Daily backup of database and storage (
storage/app/public) - โ๏ธ Multi-destination support: Local, Amazon S3, Google Drive
- ๐งผ Auto-delete backups older than configurable days (default 5 days)
- ๐ฏ Configurable cleanup scope: clean all destinations or local only
- ๐งพ List, download, and delete backups from all destinations via Blade UI
- ๐ค Access control using roles and middleware
- ๐ Configurable via
config/laravelBackup.php
๐ฅ Installation
Install the package via composer:
โ๏ธ Configuration
Edit the config file at: config/laravelBackup.php
Backup Destinations
Enable one or more destinations:
- Local: Saves backups to local disk (
storage/backups/by default) - S3: Uploads backups to Amazon S3 (or compatible services like DigitalOcean Spaces, MinIO)
- Google Drive: Uploads backups to Google Drive
When multiple destinations are enabled, backups are saved to all enabled destinations simultaneously.
Cleanup Scope
'all': Delete old backups from all destinations (local + cloud)'local': Delete old backups from local storage only (cloud backups kept indefinitely)
Storage Directory Backup
- When
backup_storage_directoryistrueAND S3/Google Drive is enabled: Storage is backed up to cloud only (skips local to save disk space) - When only local storage is enabled: Storage backup is skipped even if
backup_storage_directoryis true
๐ก๏ธ Access Control
To enable UI access control based on user roles:
- Set
'check_access' => true - Add roles in
'allowed_roles' => ['Admin'] - Ensure your
Usermodel has ahasRole()method (e.g., using spatie/laravel-permission)
Middleware used:
Avcodewizard\LaravelBackup\Http\Middleware\CheckLaravelBackupAccess
๐ฅ๏ธ Web Interface
Access the UI at:
Example route setup (already included in the package):
๐ Usage
Create Backup via Web
- Go to
/laravel-backup - Click Create Backup
- If use want to create backup from ui, make sure to run the queue worker:
Create Backup via Terminal
๐งน Automatic Cleanup
Backups older than keep_days will be deleted automatically.
Add to Scheduler
Laravel 11+ (routes/console.php):
Laravel 10 and below (app/Console/Kernel.php):
๐ Backup Storage
Backups are saved to all enabled destinations:
Local Storage
Cloud Storage (S3, Google Drive)
Backups are stored in the configured path (default: backups/ folder)
File Naming
Each backup includes:
YYYY-MM-DD-HH-MM-SS_database.sql.gz- Database backupYYYY-MM-DD-HH-MM-SS_storage.zip- Storage backup (cloud only)
๐งโ๐ป Developer Notes
Publish Config & Views
This will publish:
config/laravelBackup.php- Blade views to
resources/views/vendor/laravel-backup/
Middleware Logic
The package uses a configurable middleware to restrict access:
You can customize access logic using roles or your own permission methods.
โ๏ธ Cloud Storage Setup
Amazon S3 / DigitalOcean Spaces / MinIO
-
Install AWS SDK
-
Add AWS Credentials to
.env - Enable S3 in
config/laravelBackup.php
Google Drive
OAuth 2.0
Uses YOUR Google Drive storage for backups. Generate a refresh token to authenticate.
-
Install Google API Client
- Create OAuth Credentials
- Go to Google Cloud Console
- Create a new project or select existing
- Enable Google Drive API
- Go to APIs & Services โ Credentials โ Create Credentials โ OAuth client ID
- Application type: Web application
- Authorized redirect URIs:
http://localhost -
Copy your Client ID and Client Secret
- Add Test User (Required for Unverified Apps)
- In Google Cloud Console, go to APIs & Services โ OAuth consent screen (left sidebar)
- Make sure Publishing Status is "Testing"
- Go to Audience section
- Under Test users, click Add Users
- Add your Google email address
-
Click Save
- Generate Refresh Token
Option A: Using credentials from config (if already set)
Option B: Passing credentials directly
Follow the prompts to authorize and get your refresh token.
-
Add to
.env - Enable in config
Note: If your refresh token becomes invalid (user revoked access), regenerate it:
๐ License
This package is open-sourced software licensed under the MIT license.
ยฉ 2025 Avcodewizard