PHP code example of ahmedweb / laravel-backup-service

1. Go to this page and download the library: Download ahmedweb/laravel-backup-service library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ahmedweb / laravel-backup-service example snippets


'google_drive' => [
    'driver' => 'google',
    'clientId' => env('GOOGLE_DRIVE_CLIENT_ID'),
    'clientSecret' => env('GOOGLE_DRIVE_CLIENT_SECRET'),
    'refreshToken' => env('GOOGLE_DRIVE_REFRESH_TOKEN'),
    'folder' => env('GOOGLE_DRIVE_FOLDER'),
    'folderId' => env('GOOGLE_DRIVE_FOLDER_ID'),
],

use AhmedWeb\LaravelBackupService\Providers\GoogleDriveStorageProvider;

return Application::configure(basePath: dirname(__DIR__))
    ->withProviders([
        GoogleDriveStorageProvider::class,
    ])
    ->create();

use Illuminate\Console\Scheduling\Schedule;

return Application::configure(basePath: dirname(__DIR__))
    ->withSchedule(function (Schedule $schedule) {
        $schedule->command('backup:run')->daily();
        $schedule->command('backup:clean')->daily();
        $schedule->command('backup:store-latest-link')->dailyAt('01:00');
        $schedule->command('backup:delete-old')->weekly();
    })
    ->create();
bash
php artisan vendor:publish --tag=laravel-backup-service

laravel-backup-service/
├── src/
│   ├── Commands/
│   │   ├── StoreLatestBackupLink.php
│   │   ├── DeleteOldBackupFiles.php
│   │   └── CleanGoogleDriveBackups.php
│   ├── Services/
│   │   └── GoogleDriveBackupService.php
│   ├── Providers/
│   │   └── GoogleDriveStorageProvider.php
├── config/
│   └── filesystems.php (optional override)