I am looking at helping out on a new project that is based on the Laravel framework. I am excited to be able to dive into a Laravel project as I have heard how “elegant” it makes PHP development. I have a new rMBP and wanted a better to contain dev environments. In the past I have used MAMP and MAMP Pro, which both help put the files and tools in place, but I have always worried they are a bit “heavy touch”. Most of the Laravel guys pointed me to Vagrant and Virtual box as a solution. After a bit of research I decided to give it a shot. Here is a brief synaposis of where I landed and what I ended up doing.
Vagrant – This is what makes the magic happen. Vagrant is a tool that allows you to do many things, the important things to me were, scripting a virtual machine (VM) setup, port forwarding and giving me an easy SSH tunnel into a VM.
VirtualBox – This is the VM software choice by most. This is free, light weight and allows for easy On/Off operation from terminal. No GUI to control really, so we have to rely on “base” images from the web. Which IMO, is not a bad thing.
Laravel – The framework I wanted to get up on the rails and start getting familiar with.
So here is how this all comes together, we are going to use Vagrant to script the setup/install of our virtual box. Once the Vagrant files are created, we pass around this VM with minimal effort – thereby ensuring a similar dev environment.
First, I want to point out that I was able to find a terrific guide here that walks through the install process. A few notes before you jump over there though, download the latest version of Vagrant, but download a 4.2 version of Virtual Box. Next, follow the install script in the guide linked above or you can download the git repo I have setup with Laravel 4 already setup in it.
I am going to assume most folks will want to download the git repo, which if you do, it should have everything you need to turn on the Vagrant box, and start to work in a Laravel 4 framework project. Do still take a peek at the guide as it explains how to turn on the Vagrant box and also SSH into the Vagrant Box. This Vagrant box uses port forwarding on 1337 and can be configured in the VagrantFile at any time. I have disabled the boot up script as everything we need is already installed.
If you skipped the review of the guide, not a problem. Here are some quick steps on getting into the Vagrant Box:
Let me know if you run into problems in the comments section.