webteractive/filament-google-drive-backup-manager

A Filament plugin for managing Google Drive backups in Laravel

Maintainers

Package info

github.com/webteractive/filament-google-drive-backup-manager

pkg:composer/webteractive/filament-google-drive-backup-manager

Statistics

Installs: 9

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.2 2026-03-27 13:09 UTC

This package is auto-updated.

Last update: 2026-03-27 13:11:14 UTC


README

Latest Version on Packagist Total Downloads

A Filament plugin for managing Spatie Laravel Backup files stored on Google Drive. View, download, delete, and trigger backups directly from your Filament admin panel.

Requirements

Installation

composer require webteractive/filament-google-drive-backup-manager

Publish the config file:

php artisan vendor:publish --tag="google-drive-backup-manager-config"

Google Drive Setup

Add your Google OAuth credentials to the published config file (config/google-drive-backup-manager.php):

'google' => [
    'client_id' => env('GOOGLE_DRIVE_CLIENT_ID'),
    'client_secret' => env('GOOGLE_DRIVE_CLIENT_SECRET'),
    'redirect' => env('GOOGLE_DRIVE_REDIRECT_URI'),
],

Then add a google disk to your config/filesystems.php:

'disks' => [
    'google' => [
        'driver' => 'google',
        'folder' => env('GOOGLE_DRIVE_FOLDER', '/'),
    ],
],

Add the corresponding values to your .env file:

GOOGLE_DRIVE_CLIENT_ID=your-client-id
GOOGLE_DRIVE_CLIENT_SECRET=your-client-secret
GOOGLE_DRIVE_REDIRECT_URI=https://yourapp.com/google-drive-backup-manager-oauth/callback
GOOGLE_DRIVE_FOLDER=/

The refresh token is automatically resolved from the user who connected their Google account via the admin panel. No manual token configuration needed.

Filament Panel Registration

Register the plugin in your Filament panel provider:

use Webteractive\GoogleDriveBackupManager\GoogleDriveBackupManagerPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugins([
            GoogleDriveBackupManagerPlugin::make(),
        ]);
}

Authorization

Access to the backup manager is controlled by a Laravel Gate. By default, the gate name is viewBackups. Define it in your AppServiceProvider:

use Illuminate\Support\Facades\Gate;

Gate::define('viewBackups', function ($user) {
    return $user->is_admin;
});

You can change the gate name in the config:

'gate' => 'yourCustomGate',

Configuration

All settings are in config/google-drive-backup-manager.php:

return [
    // Storage disk name (must match a disk in config/filesystems.php)
    'disk' => 'google',

    // Laravel Gate for authorization
    'gate' => 'viewBackups',

    // Filament sidebar navigation group
    'navigation_group' => 'System',

    // Sidebar sort order
    'navigation_sort' => 5,

    // Named route for downloading backups
    'download_route' => 'backup.download',

    // Column on users table for storing Google OAuth tokens
    'google_token_column' => 'google_backup',

    // Queue name for backup jobs (null = default queue)
    'queue' => null,

    // Google OAuth credentials (kept within this package's config)
    'google' => [
        'client_id' => env('GOOGLE_DRIVE_CLIENT_ID'),
        'client_secret' => env('GOOGLE_DRIVE_CLIENT_SECRET'),
        'redirect' => env('GOOGLE_DRIVE_REDIRECT_URI'),
    ],

    // Route middleware
    'middleware' => ['web', 'auth'],

    // Base path for OAuth routes
    'oauth_base_path' => 'google-drive-backup-manager-oauth',

];

Scheduling Backups

This plugin provides an on-demand UI for triggering backups, but does not schedule them automatically. To run backups on a schedule, add the Spatie backup commands to your application's routes/console.php:

use Illuminate\Support\Facades\Schedule;

Schedule::command('backup:run')->daily()->at('02:00');
Schedule::command('backup:clean')->daily()->at('03:00');

Refer to the Spatie Laravel Backup docs for scheduling options, notification setup, cleanup strategies, and other configuration.

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.