Cover of the book Symfony 5: The Fast Track

Symfony 5: The Fast Track is the best book to learn modern Symfony development, from zero to production. +300 pages showcasing Symfony with Docker, APIs, queues & async tasks, Webpack, SPAs, etc.


You are browsing the documentation for Symfony 3.2 which is not maintained anymore.

Consider upgrading your projects to Symfony 5.2.

Using Symfony with Homestead/Vagrant

3.2 version

Using Symfony with Homestead/Vagrant

In order to develop a Symfony application, you might want to use a virtual development environment instead of the built-in server or WAMP/LAMP. Homestead is an easy-to-use Vagrant box to get a virtual environment up and running quickly.


Due to the amount of filesystem operations in Symfony (e.g. updating cache files and writing to log files), Symfony can slow down significantly. To improve the speed, consider overriding the cache and log directories to a location outside the NFS share (for instance, by using sys_get_temp_dir). You can read this blog post for more tips to speed up Symfony on Vagrant.

Install Vagrant and Homestead

Before you can use Homestead, you need to install and configure Vagrant and Homestead as explained in the Homestead documentation.

Setting Up a Symfony Application

Imagine you’ve installed your Symfony application in ~/projects/symfony_demo on your local system. You first need Homestead to sync your files in this project. Execute homestead edit to edit the Homestead configuration and configure the ~/projects directory:

# ...
    - map: ~/projects
      to: /home/vagrant/projects

The projects/ directory on your PC is now accessible at /home/vagrant/projects in the Homestead environment.

After you’ve done this, configure the Symfony application in the Homestead configuration:

# ...
    - map:
      to: /home/vagrant/projects/symfony_demo/web
      type: symfony

The type option tells Homestead to use the Symfony nginx configuration.

At last, edit the hosts file on your local machine to map to (which is the IP used by Homestead):

# /etc/hosts (unix) or C:\Windows\System32\drivers\etc\hosts (Windows)

Now, navigate to in your web browser and enjoy developing your Symfony application!

See also

To learn more features of Homestead, including Blackfire Profiler integration, automatic creation of MySQL databases and more, read the Daily Usage section of the Homestead documentation.

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.