Back to Top

How to Backup Laravel Apps All in One Guide


Laravel is known to be a great PHP framework that contains an elegant, simple and expressive syntax that assists in coming up with great applications. The Laravel is known to ease process of development by making the repetitive tasks that are used in the development of most web applications including and not limited to caching, routing, authentication and session’s simple. Here in this article, I am going to explain to Backup Laravel Apps.
The Laravel app is also known to provide some great features such as the scalability, extension ability, quick institution and development speed. It also provides great programming results when compared to other programming tools hence most developers are known to prefer using the Laravel. Also, Learn how to backup MySQL database in PHP

How to Backup Laravel Apps?

To backup your Laravel apps, run:

In case you are interested in backing up a specific disk, you will run:

To back up the db, run:

To back up only the files and skip dumping databases, run:

How to Determine the Backup Content

The configuration below will help you determine the databases and files that will be backed up.

Together will the selected and zipped files, the specified databases will be damped and the zip file named as /.zip.

The more files you will back up the bigger the zip file will be. Hence, it is important you ensure there is enough free space on the desk in order to create the zip file. The source file will be deleted after the zip file has been copied to destinations.

Determine Backup Destination

You can copy the zipped backup to one or more file systems. Here is where you will specify the file systems destinations.

Get Notified When Backup fails

It is possible to get notified whenever backup goes wrong.

You should start backing up your websites in production in case you have not been doing so. You need to be prudent with your back ups so that incase there is a data loss you will be able to easily and quickly recover.

Most of the projects today are version controlled hence, the project files will always be automatically backed up to a remote respiratory.

There are two major ways you can perform the Laravel apps back up. They include:

  • A dedicated external service that handles the backup
  • The application that handles the backup itself through the code

Self Handling Back ups

For example, I always use the Spatie’s Laravel Backup package in taking care of myself handling backups. The Spatie is easy to set up and enables you to save your database backups offsite to any file system that you have configured in the Laravel 5. However, extra features have been promised in the next release that will take place in a few months.

One of the alternative packages that I have not managed to try but seems to be common on the GitHub is the framework agnostic Backup Manager. This backup manager comes with the Laravel driver making it trivial to set up and get back ups going in minutes.

The External Back up Service

The external back up service will always make the backing up many websites much easier and provides one with a single dashboard that will be able to handle all the backups. I have managed to try two different ones, the BitCan and the Ottomatik

  1. Otoomatik
  2. The Ottomatick is a service that has been specifically designed for the Laravel apps. The Ottomatick requires one to install a small application on the server before you can commence in configuring your backups.

  3. BitCan
  4. The BitCan will allow you to configure servers either by installing applications that are similar to the Ottomatik or by installing their public SSH key. The public key approach


You need to be careful with the ‘—only-files’ and ‘—only-db’ when you are monitoring your backups. However, when you are monitoring backups, the package will never make a distinction between a backup that only contains databases and files and full backups.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular Posts

How to define PHP Magic constants

Posted on 7 years ago


How To use Store Procedure with PDO

Posted on 7 years ago


What are Lambdas and Closures in PHP?

Posted on 1 year ago


HTML5 Geolocation API with Example

Posted on 1 year ago


PHP Tutorial for beginners

Posted on 2 years ago