Download the PHP package ellera/yii2-backup without Composer

On this page you can find all versions of the php package ellera/yii2-backup. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yii2-backup

Yii2-Backup

Console backup for yii2 applications.

Current limitations:

Getting started

Installation

The preferred way to install this extension is through composer.

Either run

or add

to the require section of your composer.json file.

Basic Usage

Add the following to your config file. For yii2 advanced template, this should be placed in console/config/main.php, for basic it should be in config/console.php. You can use another name then backup but you'll need to adjust the commands accordingly.

Then migrate database migrations. This will create a table named backup in your database.

When the migration is done, you're ready to backup your site. Use php yii *command* or ./yii *command* with the commands from the following table:

Command Description
backup List all the available commands
backup/create "Optional comment" Crate a manual backup
backup/create/cron "Optional comment" Use this command for cron jobs
backup/list #OptionalPage Lists the current backups
backup/delete #ID Deletes a backup
backup/restore #ID Restores a backup
Manual: Create backup

php yii backup/create "Your Comment"

Cron: Create backup

php yii backup/create/cron "Cron Job - Daily backup"

Manual: List backups

php yii backup/list (# optional page number)

Manual: Restore backup

php yii backup/restore #

This will create an additional backup of the state before the restore

Manual: Delete backup

php yii backup/delete #

Advanced Usage

Backing up files and folders

You can backup as many locations as you'd like by adding them to the folders array. To create backups require read access to the folder and files, to restore requires write/delete access. The folders will be zipped and saved in the backup folder.

Changing or adding database handlers

You can backup as many databases as you'd like, but they have to be defined in your config as yii\db\Connections. Add the connection name to the array (defautls to only db).

Database Conflict

If you already have a table named backup, create a table with your own migration and add 'table' => 'new_table_name' to the configuration. The content of the table can be found in the migration.

Change the default backup location

If you want to store the backups in another directory, add 'path' => 'new/path' to the config.

This variable is parsed trough Yii::getAlias() and defaults to @app/_backup.

Upload to remote server

If you want redundant backup over several servers, this module supports scp over SSH. For this function to work, you need to have SSH keys in place and the user must have write access to the remote folder specified in the config. It's highly recommended to create a user on the remote server for this purpose - do not use root.

Create a cron job

If you want to automate the backup you can use the create/cron method php yii backup/create/cron "Cron-Job - Daily Backup". This method is less verbose and will only echo out one line for logging to file.

An example cron job could look like this:

Automated Cleanup

If you want the system to automatically clear out old backups, you can configure automated_cleanup.

automated_cleanup defaults to false, and require an array of boolean values to be activated.

When activated the cron method will delete all but the latest backup of the period before the previous period.

Lets look at an example: If you run hourly backups, but have configured 'daily' => true, the first cron job of a new day will delete all but the latest backup from the period before the previous day.

Extendable methods

If you need to alter the system state before and after backups and restores, you can do that by extending the Methods class. This could be useful to end all database connections or put the system into maintenance mode.

Crate a new file in your project. For instance console\components\BackupMethods:

And update the config to use this file:

This methods will be invoked before and after create and restore, and if the before methods return false the execution will be stopped.

If the after methods returns false they will echo a warning to the terminal/log.


All versions of yii2-backup with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.0
ext-zip Version *
yiisoft/yii2 Version ~2.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ellera/yii2-backup contains the following files

Loading the files please wait ....