Looking to hire Laravel developers? Try LaraJobs

laravel-backup-package maintained by pavliq

Description
Laravel package for database backup
Author
Last update
2025/08/20 19:37 (dev-master)
License
Links
Downloads
3

Comments
comments powered by Disqus

Laravel Backup Package

  1. Installation
composer require pavliq/laravel-backup-package:dev-master
  1. Create an artisan command
php artisan make:command BackupDatabase
  1. Open the generated file and add
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Pavliq\LaravelBackupPackage\Services\DatabaseBackupService;

class BackupDatabase extends Command
{
    protected $signature = 'app:backup';

    public function handle(DatabaseBackupService $service)
    {
        $service->backupDatabase();
    }
}
  1. Run the command
php artisan app:backup
  1. Optional: Limit the number of backups

You can set a MAX_BACKUPS variable in your .env file to limit the number of stored backup files.

By default, it keeps 5 backups:

MAX_BACKUPS=5

Database backups will be created in storage/app/backups/db