New Feature: Setup Homestead Per Project
Published on by Eric L. Barnes
Over the weekend, Homestead received a new update that allows you to run it on a per project basis. Previously Homestead was designed so that you install it once on your system and share all your sites within the virtual machine. Joe Ferguson created the pull request to help get this feature implemented and he has a full write up on his blog.
To install Homestead directly into your project all that is required is pulling it in using Composer:
composer require laravel/homestead
Once Homestead has been installed, use the make command to generate the Vagrantfile and Homestead.yaml file in your project root. The make command will automatically configure the sites and folders directives in the Homestead.yaml file:
php vendor/bin/homestead make
You can also set hostname and name values for the virtual machine. It is important to note that you can’t have more than one vagrant machine with the same name. By default the make command will use your project’s folder name as the box name.
php vendor/bin/homestead make --name=VagrantName --hostname=myhost
For more information consult the official documentation on this new feature.
Eric is the creator of Laravel News and has been covering Laravel since 2012.