Download the PHP package wnx/laravel-backup-restore without Composer

On this page you can find all versions of the php package wnx/laravel-backup-restore. 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 laravel-backup-restore

Restore database backups made with spatie/laravel-backup

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A package to restore a database backup created by the spatie/laravel-backup package.

The package requires Laravel v10.17 or higher and PHP 8.1 or higher.

Installation

You can install the package via composer:

Optionally, you can publish the config file with:

This is the contents of the published config file:

Usage

To restore a backup, run the following command.

You will be prompted to select the backup you want to restore and whether the encryption password from the configuration should be used, to decrypt the backup.

The package relies on an existing config/backup.php-file to find your backups, encryption/decryption key and database connections.

Note
By default, the name of a backup equals the value of the APP_NAME-env variable. The restore-commands looks for backups in a folder with that backup name. Make sure that the APP_NAME-value is correct in the environment you're running the command.

Optional Command Options

You can pass disk, backup, database connection and decryption password to the Artisan command directly, to speed things up.

Note that we used latest as the value for --backup. The command will automatically download the latest available backup and restore its database.

--disk

The filesystem disk to look for backups. Defaults to the first destination disk configured in config/backup.php.

--backup

Relative path to the backup file that should be restored. Use latest to automatically select latest backup.

--connection

Database connection to restore backup. Defaults to the first source database connection configured in config/backup.php.

--password

Password used to decrypt a possible encrypted backup. Defaults to encryption password set in config/backup.php.

--reset

Reset the database before restoring the backup. Defaults to false.


The command asks for confirmation before starting the restore process. If you run the backup:restore-command in an environment where you can't confirm the process (for example through a cronjob), you can use the --no-interaction-option to bypass the question.

Health Checks

After the backup has been restored, the package will run a series of health checks to ensure that the database has been imported correctly. By default, the package will check if the database has tables after the restore.

You can add your own health checks by creating classes that extend Wnx\LaravelBackupRestore\HealthChecks\HealthCheck-class.

Add your health check to the health-checks-array in the config/laravel-backup-restore.php-file.

Check Backup Integrity automatically with GitHub Actions

In addition to running the backup:restore command manually, you can also use this package to regularly test the integrity of your backups using GitHub Actions.

The GitHub Actions workflow below can either be triggered manually through the Github UI (workflow_dispatch-trigger) or runs automatically on a schedule (schedule-trigger). The workflow starts an empty MySQL database, clones your Laravel application, sets up PHP, installs composer dependencies and sets up the Laravel app. It then downloads, decrypts and restores the latest available backup to the MySQL database available in the GitHub Actions workflow run. The database is wiped, before the workflow completes.

Note that we pass a couple of env variables to the backup:restore command. Most of those values have been declared as GitHub Action secrets. By using secrets our AWS keys are not being leaked in the workflow logs.

If the restore command fails, the entire workflow will fail, you and will receive a notification from GitHub. This is obviously just a starting point. You can add more steps to the workflow, to – for example – notify you through Slack, if a restore succeeded or failed.

Testing

The package comes with an extensive test suite. To run it, you need MySQL, PostgreSQL and sqlite installed on your system.

For MySQL and PostgreSQL the package expects that a laravel_backup_restore database exists and is accessible to a root-user without using a password.

You can change user, password and database by passing ENV-variables to the shell command tp run the tests … or change the settings locally to your needs. See TestCase for details.

Testing with Testbench

You can invoke the backup:restore command using testbench to test the command like you would in a Laravel application.

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.


All versions of laravel-backup-restore with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-zip Version *
illuminate/contracts Version ^10.17.0 || ^11.0
laravel/prompts Version ^0.1.11
spatie/laravel-backup Version ^8.0
spatie/laravel-package-tools Version ^1.14.0
spatie/temporary-directory Version ^2.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 wnx/laravel-backup-restore contains the following files

Loading the files please wait ....