Skip to content

Configuration

Nick Hamnett edited this page Jun 11, 2026 · 1 revision

Package Config (config/backup-manager.php)

Published via php artisan vendor:publish --provider="SameOldNick\BackupManager\ServiceProvider".

Routes

All routes are grouped under a common prefix and middleware stack.

Key Type Default Description
routes.enabled bool true Enable or disable all backup manager web routes
routes.all.middleware array ['web'] Middleware applied to every route group
routes.all.prefix string '/backup' URL prefix for all routes
routes.all.as string 'backup.' Route name prefix
routes.management.middleware array ['auth'] Extra middleware for management routes (CRUD, perform)
routes.download.middleware array ['signed'] Middleware for file download routes

Example

return [
    'routes' => [
        'enabled' => true,

        'all' => [
            'middleware' => ['web'],
            'prefix' => '/backup',
            'as' => 'backup.',
        ],

        'management' => [
            'middleware' => ['auth'],
        ],

        'download' => [
            'middleware' => ['signed'],
        ],
    ],
];

Spatie Backup Config (config/backup.php)

This package extends spatie/laravel-backup and reads its standard configuration. Most sections are used as-is; the package overrides the following with database-driven values:

  • destination.disks — Replaced with active FilesystemConfiguration records from the database. The value in config/backup.php is ignored when the database is available.
  • Schedules — Backup and cleanup schedules are stored in backup_schedules and cleanup_schedules tables, not in routes/console.php.

All other sections in config/backup.php apply normally:

Source

Defines what gets backed up — files and databases.

'source' => [
    'files' => [
        'include' => [base_path()],
        'exclude' => [
            base_path('vendor'),
            base_path('node_modules'),
        ],
        'follow_links' => false,
        'ignore_unreadable_directories' => false,
        'relative_path' => null,
    ],
    'databases' => [
        'mysql',
    ],
],

Destination

Controls how the zip archive is created and which disks are used. The disks array in this file is overridden at runtime — active FilesystemConfiguration records from the database replace it. The remaining destination settings still apply from the config file.

'destination' => [
    'compression_method' => ZipArchive::CM_DEFAULT,
    'compression_level' => 9,
    'filename_prefix' => '',
    'disks' => ['local'],             // ← overridden by database records
    'continue_on_failure' => false,
],

Database Dump

Controls dump compression, timestamp formatting, filename base, and file extension.

'database_dump_compressor' => null,
'database_dump_file_timestamp_format' => null,
'database_dump_filename_base' => 'database',
'database_dump_file_extension' => '',

Encryption

'password' => env('BACKUP_ARCHIVE_PASSWORD'),
'encryption' => 'default',  // 'none', 'default', 'aes128', 'aes192', 'aes256'

Notifications

Spatie Backup can notify via mail, Slack, etc. on backup/cleanup events:

Event Default Channel
BackupHasFailedNotification mail
BackupWasSuccessfulNotification mail
CleanupHasFailedNotification mail
CleanupWasSuccessfulNotification mail
HealthyBackupWasFoundNotification mail
UnhealthyBackupWasFoundNotification mail

Monitoring

Health checks run after each backup to verify integrity:

'monitor_backups' => [
    [
        'name' => env('APP_NAME', 'laravel-backup'),
        'disks' => ['local'],
        'health_checks' => [
            \Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1,
            \Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 5000,
        ],
    ],
],

Cleanup

Controls how old backups are pruned:

'cleanup' => [
    'strategy' => \Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy::class,
    'default_strategy' => [
        'keep_all_backups_for_days' => 7,
        'keep_daily_backups_for_days' => 16,
        'keep_weekly_backups_for_weeks' => 8,
        'keep_monthly_backups_for_months' => 4,
        'keep_yearly_backups_for_years' => 2,
        'delete_oldest_backups_when_using_more_megabytes_than' => 5000,
    ],
],

See the Spatie Backup documentation for all available options.

Clone this wiki locally