shuvroroy / filament-spatie-laravel-backup
This plugin is built on top of Spatie's Laravel-backup package
Fund package maintenance!
Buy Me A Coffee
Installs: 216 076
Dependents: 12
Suggesters: 0
Security: 0
Stars: 241
Watchers: 4
Forks: 53
Open Issues: 13
Requires
- php: ^8.1
- filament/filament: ^4.0
- spatie/laravel-backup: ^8.0|^9.0
- spatie/laravel-package-tools: ^1.15
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.0
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^9.0.0||^8.22.0
- pestphp/pest: ^2.0||^3.0
- pestphp/pest-plugin-arch: ^2.0||^3.0
- pestphp/pest-plugin-laravel: ^2.0||^3.0
- phpstan/extension-installer: ^1.3
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- dev-main
- v3.0.0-beta2
- v3.0.0-beta1
- 2.x-dev
- v2.2.4
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.1
- v2.0.0
- 1.x-dev
- v1.4.0
- v1.3.1
- v1.3.0
- v1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.0
- v1.0.1
- v1.0.0
- dev-dependabot/github_actions/actions/checkout-5
- dev-dependabot/composer/orchestra/testbench-tw-10.4.0
This package is auto-updated.
Last update: 2025-08-12 15:31:16 UTC
README
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 ShuvroRoy\FilamentSpatieLaravelBackup\Pages\Backups as BaseBackups; class Backups extends BaseBackups { protected static ?string $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 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.
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', ]; 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 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.