Cloning a Laravel Project

Today, I am making a copy of a Laravel project. I a doing it to have a testing and development environment that is separate from my main Laravel application so I can tinker with it without messing up the main project. Anyway, its a good idea, so here is how I did it on my localhost server. The process will be nearly the same on any server though.

  1. copy your main project folder and give it a new name so you can keep it in the same directory as your original project. By “project folder”, I am referring to your entire Laravel project, so your project folder could be named anything (whatever you decided to call it), so it will be different for everyone. The main project folder should contain a “vendor” directory, an “app” directory, a “public” directory(unless you took it out and placed pubic files in the main project folder as I have done before) and there will be some files also, but I am just telling you basically what folders should be in a project to be clear on what I mean when I say we are cloning a project. For example, if you project directory was named “Project”  make copy that folder and place the copy in the same directory as Project and name it “Project2” or anything other than it’s original name. I will refer to the original project folder as “Project” and the copy as “Project2” in this tutorial. If you are on the local server as I am, just right click on the Project folder and copy and paste it then rename it to “Project2”. If you are on a live web server you will probably be using a command prompt and would do something like “cp Project Project2” from the command line while in the working directory that contains the project folder.
  2. Now add a new database for your cloned project. If the project you are cloning already has data in the database, then you will want to dump it to a sql dump file, otherwise just create a new empty database and give it a new name. I named mine. if you have a localhost set up like mine, you’d go to http://localhost/phpmyadmin/ and clone the database which I shouldn’t have to explain here as it is something you should know if you are using Laravel. If you need help, Google Mysql/phpmyadmin tutorials along with the server type and you’ll find what you need.

So far that did it. Just one main step? Yea, it looks like it(but then I quickly realized I would prefer to run the clone off of it’s own database, so I added step 2 above), I tested it by going to http://localhost/Project2/ and it works, but if I run into problems later on, I will add notes to this tutorial on any further actions that may be required as I come across any. I may not because everything seems to work already!