You need to learn Vagrant

Last weekend, I spent some time with a close friend of mine who is a really talented developer. He spoke to me about VAGRANT and what it does. It stirred my curiosity to check it out even further. After the weekend, I started to check out VAGRANT. I have only spent a couple of hours learning Vagrant but at this point, I confess that I already hold VAGRANT in high regards.


If you don’t know what Vagrant is, I will explain and tell you the problem it seeks to solve. Most PHP developers are already familiar with the LAMP, WAMP, or XAMP development environments and their capabilities but not many developers yet know about VAGRANT and what it can offer.


I will attempt to explain what VAGRANT is in a very simple fashion as I myself struggled a bit to totally grasp it at first. VAGRANT is basically a tool that takes out all the trouble in setting up a local development environment. VAGRANT has a single config file where you can specify what features you would like to have on your development environment server. VAGRANT helps you setup virtual development servers on your local machine to simulate an actual web host server. VAGRANT sets up this virtual server for you using VirtualBox or VmWare. VAGRANT basically has a config file in which it tells your installed VirtualBox or VMWare what kind of virtual machine to create for your development environment.


Bear in mind that this is not a tutorial on setting up VAGRANT but rather my own thoughts about VAGRANT and why I would be using it from now onwards in my future projects.


Imagine you and your team of other 6 developers have a project that uses Redis, Memcached, cURL, Laravel PHP Framework, MySQL, and MongoDB. In addition, Laravel needs a specific PHP version say 5.3.7 or even higher and the PHP PDO extension. The ideal way to develop locally would be for each member of your team to setup identical development environments to meet the project needs. The problem starts when you realize that not all developers understand System Administration including the fact that different team members could have different operating systems. So getting the development environment to be identically setup could become a big task.


Enter VAGRANT !. VAGRANT sets up the complete development environment no matter your local operating system. Good thing is, you can replicate the same development environment across several machines by simply using the same VAGRANT config file. VAGRANT just spins up the box that contains all your project needs so that you can focus on writing code rather than maintaining your development environment.  VAGRANT does this with just a single config file and a couple of commands.


I can’t even start to tell you how stressful it is trying to configure or install packages if you are using WAMP, LAMP or XAMP. In addition, even when you do install or setup additional packages, they are stored on your local machine even after the project is completed and you no longer need them. Thereby, making your system bloated unnecessarily.  Well, with VAGRANT no need for that problem because you can spin up boxes when you need them or destroy them when you no longer need them.


The case for VAGRANT is a strong one in my opinion. VAGRANT also has Laravel Homestead which is a prepackaged VAGRANT box with all that you need that to run you Laravel applications. Let’s face it Laravel is currently the leading PHP framework and we can be sure to see even more and more developers who code with Laravel start to embrace VAGRANT.

Let me know your thoughts.

Share this: