PHP code example of ellera / yii2-backup

1. Go to this page and download the library: Download ellera/yii2-backup 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/ */

    

ellera / yii2-backup example snippets


'modules' => [
    ...
    'backup' => [
        'class' => 'ellera\backup\Module'
    ]
    ...
]

'modules' => [
    ...
    'backup' => [
        'class' => 'ellera\backup\Module',
        'folders' => [
            'images' => '@app/web/images'
        ],
    ]
    ...
]

'modules' => [
    ...
    'backup' => [
        'class' => 'ellera\backup\Module',
        'databases' => [
            'db', 
            'db2'
        ],
    ]
    ...
]

'modules' => [
    ...
    'backup' => [
        'class' => 'ellera\backup\Module',
        'table' => 'your_new_table_name'
    ]
    ...
]

'modules' => [
    ...
    'backup' => [
        'class' => 'ellera\backup\Module',
        'path' => '@app/_backup'
    ]
    ...
]

'modules' => [
    ...
    'backup' => [
        'class' => 'ellera\backup\Module',
        'servers' => [
            // Unique name
            'server_name' => [
                // Server IP or domain
                'host' => '192.186.0.1',
                // Server username
                'user' => 'remote_user',
                // Remote backup path
                'path' => '/var/backups/myserver'
            ]
        ]
    ]
    ...
]

    'modules' => [
    'backup' => [
        'class' => 'ellera\backup\Module',
        'automated_cleanup' => [
            'daily' => true,
            'weekly' => true,
            'monthly' => true,
            'yearly' => true
        ]
    ]
],



namespace console\components;


class BackupMethods extends \ellera\backup\components\Methods
{
	public function beforeCreate() : bool
	{
		return true;
	}

	public function afterCreate() : bool
	{
		return true;
	}

	public function beforeRestore() : bool
	{
		return true;
	}

	public function afterRestore() : bool
	{
		return true;
	}
}

'modules' => [
	'backup' => [
		'class' => 'ellera\backup\Module',
		'methods_class' => 'console\components\BackupMethods'
	]
],

php composer.phar 

php yii migrate/up --migrationPath=@vendor/ellera/yii2-backup/src/migrations