This tutorial describes how to get started with Vagrant integration in PhpStorm.
Vagrant is a tool which helps us create reproducible development environments. By scripting a virtual machine, Vagrant allows us to share a development machine by sharing a simple script. Other developers can then launch an identical machine by running the vagrant up command. PhpStorm comes with support for Vagrant within the IDE.
To be able to work with Vagrant in PhpStorm, both Vagrant and Oracle VirtualBox have to be installed on your system.
Download and install Vagrant from their official website.
From the VirtualBox website, download and install the latest version of VirtualBox.
From the Settings | Project Settings | Vagrant window, specify the required parameters for Vagrant integration. The path to the Vagrant executable must be provided, as well as the instance folder (can be empty to use the project directory).
Using the Add button, we can add our first Vagrant Box. PhpStorm will provide the name and URL to the lucid32 box by default; other boxes can be specified as well.
The VagrantFile contains all information about the virtual machine. It contains details about the virtual machine such as the virtual IP address, port mappings and memory to assign. Next to that, it can specify which folders are shared and which third-party software should be installed on the machine.
Note: the PuPHPet website has a great tool for configuring a Vagrant machine and generating a VagrantFile.
The VagrantFile can be created manually or by using the Tools | Vagrant | Init in Project Root menu.
This will trigger creation of a default VagrantFile.
The Vagrant machine can be started from the Tools | Vagrant | Up menu. This will configure the virtual machine in VirtualBox if this hasn't been done yet, as well as boot it.
Progress can be seen from the Run tool window.
Once completed, the Vagrant machine will be ready for use.
You can now continue to Working with Advanced Vagrant features in PhpStorm.