Spatie Laravel Backup
CommunityThis package provides a Filament page that you can create backup of your application by using `spatie/laravel-backup` package.
Author:
Shuvro Roy
Package health
BetaAutomated checks of this plugin's Composer package
13 checks
-
Passed:
Current Laravel version supported
—
Package dependencies resolve together with current Laravel
13.0. -
Passed:
Current PHP version supported
—
Constraint
^8.2supports current PHP8.5. - Skipped: Current Symfony version supported
- Passed: Abandoned or archived — No consulted source marks the package abandoned (packagist, github).
- Passed: Commit and release recency — Active: last commit 17 days ago; last release 114 days ago.
-
Passed:
composer.lock not committed by library
—
composer.lockis absent from the released dist archive. - Passed: Dist archive is lean
- Failed: GitHub Actions pinned to SHA — View details on Plumb
- Passed: Open security advisories
- Passed: Dependabot PR responsiveness — No open Dependabot PRs.
- Warning: Dependabot or Renovate configured — Updater does not cover the JavaScript ecosystem, which has a committed lockfile.
-
Failed:
Dependency update cooldown configured
—
No cooldown configured in
.github/dependabot.yml. View details on Plumb - Passed: Provides a security policy
filament/
namespace. Review the source and install at your own risk. Found
malware or an unresolved security issue the author won't
address?
Report it
.
Documentation
- Installation
- Usage
- Permissions Setup (for Creating, Downloading & Deleting backups)
- Customising navigation
- Customising the polling interval
- Customising the queue
- Customising the timeout
- Customising who can access the page
- Upgrading
- Testing
- Changelog
- Contributing
- Security Vulnerabilities
- Credits
- License
This package provides a Filament page that you can create backup of your application. You'll find installation instructions and full documentation on spatie/laravel-backup.
#Installation
You can install the package via composer:
composer require shuvroroy/filament-spatie-laravel-backup
Publish the package's assets:
php artisan filament:assets
You can publish the lang file with:
php artisan vendor:publish --tag="filament-spatie-backup-translations"
#Usage
You first need to register the plugin with Filament. This can be done inside of your PanelProvider, e.g. AdminPanelProvider.
<?php
namespace App\Providers\Filament;
use Filament\Panel;
use Filament\PanelProvider;
use ShuvroRoy\FilamentSpatieLaravelBackup\FilamentSpatieLaravelBackupPlugin;
class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugin(FilamentSpatieLaravelBackupPlugin::make());
}
}
If you want to override the default Backups page icon, heading then you can extend the page class and override the navigationIcon property and getHeading method and so on.
<?php
namespace App\Filament\Pages;
use Illuminate\Contracts\Support\Htmlable;
use ShuvroRoy\FilamentSpatieLaravelBackup\Pages\Backups as BaseBackups;
class Backups extends BaseBackups
{
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-cpu-chip';
public function getHeading(): string | Htmlable
{
return 'Application Backups';
}
public static function getNavigationGroup(): ?string
{
return 'Core';
}
}
Then register the extended page class on AdminPanelProvider class.
<?php
namespace App\Providers\Filament;
use Filament\Panel;
use Filament\PanelProvider;
use App\Filament\Pages\Backups;
use ShuvroRoy\FilamentSpatieLaravelBackup\FilamentSpatieLaravelBackupPlugin;
class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugin(
FilamentSpatieLaravelBackupPlugin::make()
->usingPage(Backups::class)
);
}
}
#Permissions Setup (for Creating, Downloading & Deleting backups)
If you're using Spatie Laravel Permission or Filament Shield, you need to manually define the permissions used by this backup panel.
#Required Permissions
download-backup– Allows downloading existing backups.delete-backup– Allows deleting backups from the panel.create-backup– Allows creating new backups from the panel.
#Seeder Example
You can create a seeder to register these permissions and assign them to a role:
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role;
class BackupPermissionSeeder extends Seeder
{
public function run(): void
{
// Create permissions
$permissions = [
'download-backup',
'delete-backup',
'create-backup',
];
foreach ($permissions as $permission) {
Permission::firstOrCreate(['name' => $permission]);
}
// Assign to a role (optional)
$role = Role::firstOrCreate(['name' => 'backup']);
$role->givePermissionTo($permissions);
// Assign role to a user (optional)
$user = \App\Models\User::find(1); // Change ID as needed
if ($user && !$user->hasRole('backup')) {
$user->assignRole('backup');
}
}
}
Run the seeder using:
php artisan db:seed --class=BackupPermissionSeeder
After this, users with the backup role will have full access to the backup panel.
#Customising navigation
You can customise the navigation icon, label, group, and sort order directly on the plugin without extending the page class:
<?php
namespace App\Providers\Filament;
use Filament\Panel;
use Filament\PanelProvider;
use ShuvroRoy\FilamentSpatieLaravelBackup\FilamentSpatieLaravelBackupPlugin;
class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugin(
FilamentSpatieLaravelBackupPlugin::make()
->navigationIcon('heroicon-o-cpu-chip')
->navigationLabel('Backups')
->navigationGroup('Settings')
->navigationSort(3)
);
}
}
All navigation methods also accept closures for dynamic values:
FilamentSpatieLaravelBackupPlugin::make()
->navigationLabel(fn (): string => __('custom.backups'))
->navigationGroup(fn (): ?string => auth()->user()->isAdmin() ? 'Admin' : 'Tools')
Pass null to navigationGroup() to remove the page from any navigation group.
#Customising the polling interval
You can customise the polling interval for the Backups by following the steps below:
<?php
namespace App\Providers\Filament;
use Filament\Panel;
use Filament\PanelProvider;
use ShuvroRoy\FilamentSpatieLaravelBackup\FilamentSpatieLaravelBackupPlugin;
class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugin(
FilamentSpatieLaravelBackupPlugin::make()
->usingPolingInterval('10s') // default value is 4s
);
}
}
#Customising the queue
You can customise the queue name for the Backups by following the steps below:
<?php
namespace App\Providers\Filament;
use Filament\Panel;
use Filament\PanelProvider;
use ShuvroRoy\FilamentSpatieLaravelBackup\FilamentSpatieLaravelBackupPlugin;
class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugin(
FilamentSpatieLaravelBackupPlugin::make()
->usingQueue('my-queue') // default value is null
);
}
}
#Customising the timeout
You can customise the timeout for the backup job by following the steps below:
<?php
namespace App\Providers\Filament;
use Filament\Panel;
use Filament\PanelProvider;
use ShuvroRoy\FilamentSpatieLaravelBackup\FilamentSpatieLaravelBackupPlugin;
class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugin(
FilamentSpatieLaravelBackupPlugin::make()
->timeout(120) // default value is max_execution_time from php.ini, or 30s if it wasn't defined
);
}
}
For more details refer to the set_time_limit function.
You can also disable the timeout altogether to let the job run as long as needed:
<?php
namespace App\Providers\Filament;
use Filament\Panel;
use Filament\PanelProvider;
use ShuvroRoy\FilamentSpatieLaravelBackup\FilamentSpatieLaravelBackupPlugin;
class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugin(
FilamentSpatieLaravelBackupPlugin::make()
->noTimeout()
);
}
}
#Customising who can access the page
You can customise who can access the Backups page by adding an authorize method to the plugin.
The method should return a boolean indicating whether the user is authorised to access the page.
<?php
namespace App\Providers\Filament;
use Filament\Panel;
use Filament\PanelProvider;
use ShuvroRoy\FilamentSpatieLaravelBackup\FilamentSpatieLaravelBackupPlugin;
class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugin(
FilamentSpatieLaravelBackupPlugin::make()
->authorize(fn (): bool => auth()->user()->email === 'admin@example.com'),
);
}
}
#Upgrading
Please see UPGRADE for details on how to upgrade 1.X to 2.0.
#Testing
composer test
#Changelog
Please see CHANGELOG for more information on what has changed recently.
#Contributing
Please see CONTRIBUTING for details.
#Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
#Credits
#License
The MIT License (MIT). Please see License File for more information.
The author
Shuvro is a senior software engineer from Dhaka, BD. He contributes to Filament and lots of other open source projects. He works for MailerLite, a digital email marketing platform.
From the same author
Featured Plugins
A selection of plugins curated by the Filament team
Custom Dashboards
Let your users build and share their own dashboards with a drag-and-drop interface. Define your data sources in PHP and let them do the rest.
Filament
Advanced Tables (formerly Filter Sets)
Supercharge your tables with powerful features like user-customizable views, quick filters, multi-column sorting, advanced table searching, convenient view management, and more. Compatible with Resource Panel Tables, Relation Managers, Table Widgets, and Table Builder!
Kenneth Sese
Blueprint
Filament Blueprint is a premium Laravel Boost extension that helps AI agents produce accurate, detailed implementation plans and security reports for Filament apps.
Filament