XAMPP has fulfilled its function, so far, but we reach a point where a virtual machine as similar as possible to the production environment is required.
This is where Vagrant comes in, that in a very simple way (and perhaps a little misleading) can be described as a manager of virtual machines.
It allows, with only one file (called Vagrantfile) at the root of our project, to describe the machine we want to user and install the necessary software. This file indicates the image that will be the basis for our virtual machine, the settings and all the necessary facilities.
The base image (called base box) can be one of many available on the net. Although the main source is the Vagrant Cloud. Just enter the URL of the box in the Vagrantfile and if it is not already installed, the download is done automatically. Of course, instead of using an existing box base, we can create one from scratch,with exactly what we need.
After this initial setup, each time we need the machine, we just need to write the ‘vagrant up’ command. Simple. Another major advantage is that the Vagrantfile may be shared between several persons (via Git, for example) so that all can work with the same virtual machine.
The official documentation is quite good and should be sufficient for most use cases.
It’s a tool that has a small initial learning curve, especially if we try to create our own base box (this tutorial helps) but it pays well after we honed all edges.