oriondevelops / filament-backup
A Filament plugin to backup your app.
Fund package maintenance!
oriondevelops
Requires
- php: ^8.1
- filament/filament: ^3.0
- illuminate/contracts: ^10.0
- spatie/laravel-backup: ^8.0
- spatie/laravel-package-tools: ^1.15.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.9
- nunomaduro/larastan: ^2.0
- orchestra/testbench: ^8.0
- pestphp/pest: ^2.0
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
README
This Filament plugin is a dedicated port of the spatie/nova-backup-tool, adapted to work seamlessly with Filament.
Much of the underlying codebase and functionality owe their origins to the work done by the contributors on the original Nova tool. This adaptation was undertaken with deep respect and acknowledgment of their effort.
The plugin lets you:
- List all backups
- Create a new backup
- Download a backup
- Delete a backup
Internally, it utilizes spatie/laravel-backup to manage these backups.
Requirements
Ensure that you meet the requirements for spatie/laravel-backup.
Installation
Install spatie/laravel-backup into your Laravel app following its installation instructions.
You can install the package via composer:
composer require oriondevelops/filament-backup
Next you should setup a queue. Any driver is fine except the sync driver.
Usage
You need to register the plugin with your preferred Filament panel providers. This can be done inside of your PanelProvider
, e.g. AdminPanelProvider
.
<?php namespace App\Providers\Filament; use Filament\Panel; use Filament\PanelProvider; use Orion\FilamentBackup\BackupPlugin; class AdminPanelProvider extends PanelProvider { public function panel(Panel $panel): Panel { return $panel // ... ->plugin(BackupPlugin::make()); } }
You can now click on the "Backups" menu item in your Filament app to see the backup plugin.
Customizing visibility, download and delete permissions
Define who can view, download, or delete backups. Tailor access based on user permissions.
<?php namespace App\Providers\Filament; use Filament\Panel; use Filament\PanelProvider; use Orion\FilamentBackup\BackupPlugin; class AdminPanelProvider extends PanelProvider { public function panel(Panel $panel): Panel { return $panel // ... ->plugin( BackupPlugin::make() ->visible(fn() => auth()->user()->can('view backups')) ->downloadable(fn() => auth()->user()->can('download backups')) ->deletable(fn() => auth()->user()->can('delete backups')), ); } }
Customizing the navigation item
<?php namespace App\Providers\Filament; use Filament\Panel; use Filament\PanelProvider; use Orion\FilamentBackup\BackupPlugin; class AdminPanelProvider extends PanelProvider { public function panel(Panel $panel): Panel { return $panel // ... ->plugin( BackupPlugin::make() ->slug('my-precious-backups') ->label('Backups') ->icon('heroicon-o-server-stack') ->group('System') ->sort(3), ); } }
Customizing the polling interval
You can customise the polling interval or disable polling:
<?php namespace App\Providers\Filament; use Filament\Panel; use Filament\PanelProvider; use Orion\FilamentBackup\BackupPlugin; class AdminPanelProvider extends PanelProvider { public function panel(Panel $panel): Panel { return $panel // ... ->plugin( BackupPlugin::make() ->polling(enabled: true, interval: '10s'), ); } }
Customizing the backup queue and page
<?php namespace App\Providers\Filament; use Filament\Panel; use Filament\PanelProvider; use Orion\FilamentBackup\BackupPlugin; use App\Filament\Pages\ExtendedBackupsPage; class AdminPanelProvider extends PanelProvider { public function panel(Panel $panel): Panel { return $panel // ... ->plugin( BackupPlugin::make() ->queue('custom-queue') ->page(ExtendedBackupsPage::class), ); } }
Contributing
Please see CONTRIBUTING for details.
Security
Please review Security Policy on how to report security vulnerabilities.
Nova Backup Tool Credits
Credits
License
The MIT License (MIT). Please see License File for more information.