PHP code example of barygi / phpbu-laravel

1. Go to this page and download the library: Download barygi/phpbu-laravel 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/ */

    

barygi / phpbu-laravel example snippets


'providers' => [
    ...
    /*
     * phpbu Backup Service Providers...
     */
    phpbu\Laravel\ServiceProvider::class,
];


return [
    /*
    |--------------------------------------------------------------------------
    | laravel configuration
    |--------------------------------------------------------------------------
    |
    | This is activated as long as you don't specify a phpbu
    | configuration file at the bottom.
    |
    */

    // no directories to backup
    // keep at least the empty array 'directories' => []

    'directories' => [
        [
            'source' => [
                'path'    => storage_path('app'),
                'options' => [],
            ],
            'target' => [
                'dirname'     => storage_path('/backup/app'),
                'filename'    => 'app-%Y%m%d-%H%i.tar',
                'compression' => 'bzip2',
            ],
            'sync' => [
                'filesystem' => 's3',
                'path'       => '/backup/app',
            ]
        ]
    ],

    // no databases to backup
    // keep at least the empty array 'databases' => []

    'databases' => [
        [
            'source' => [
                'connection' => 'mysql',
                'options'    => []
            ],
            'target' => [
                'dirname'     => storage_path('backup/db'),
                'filename'    => 'dump-%Y%m%d-%H%i.sql',
                'compression' => 'bzip2',
            ],
            'sync' => [
                'filesystem' => 's3',
                'path'       => '/backup/db',
            ]
        ],
    ],
    'config' => __FILE__,

    /*
    |--------------------------------------------------------------------------
    | phpbu configuration
    |--------------------------------------------------------------------------
    |
    | Path to a phpbu configuration file.
    | You can use a phpbu.xml or phpbu.json configuration.
    | If you use one of those the configuration above will be ignored.
    | This is deactivated by default so you can setup your backup using
    | the configuration above
    */

    'phpbu' => null,
];

bash
php artisan vendor:publish --provider="phpbu\Laravel\ServiceProvider"