In this tutorial, we have explained how to Setup Vagrant For Symfony project for Windows. Vagrant is a tool for building and managing virtual machine environments in a single workflow. With an easy-to-use workflow and focus on automation, Vagrant lowers development environment setup time, increases production parity, and makes the “works on my machine” excuse a relic of the past.
Vagrant is an open-source software product for building and maintaining portable virtual software development environments, e.g., for VirtualBox, KVM, Hyper-V, Docker containers, VMware, and AWS, In this tutorial we are setup vagrant by VirtualBox provider, As VirtualBox is supported to windows.
Step 1: Take clone of symfony project
First, please take clone of symfony project, for which you want to setup the vagrant
Step 2: Take clone of vagrant Repository
Please take clone of the vagrant repository, and then please Select the branch specific to what you’re working on ( Navigate to vagrant Folder )
Step 3: Install vagrant plugin
Please run the below command, it’ll take few seconds
vagrant plugin install vagrant-bindfs
If you face this error `bash: vagrant: command not found` during installation of vagrant plugin, first you have to install Vagrant.
Step 4: Adjust the artifact path
Find the settings.yml file in the Vagrant folder and adjust the artifact path to point to the repositories cloned in steps 1
If you setup this vagrant for symfony then you have to put your project path to app, & if you are working with wordpress then please put to www.
Step 5: Add your host-url to host file
Add the following lines to your hosts file ( C:\Windows\System32\drivers\etc\hosts ):
192.168.100.100 example.test www.example.test join.example.test
Name of the virtual host by which you want to access your project.
Note: For open the host file, you have to open as Administration, otherwise will not allow to edit it.
Step 6: Install virtualbox
Now if you run the
`vagrant up`, you’ll face the error, so first you need to install VirtualBox For windows.
https://www.virtualbox.org/wiki/Downloads – just click on Windows hosts.
Step 7: vagrant up
Now feel free to run the command with provideName.
vagrant up --provider=virtualbox
There will be deprecation warnings and errors, but despite that everything should install okay
Step 8: Navigate to project
Navigate to https://www.example.test/ ( run this url in browser ).
That’s all, now you project run with above host url.
Conclusion: I hope this tutorial helpful for you, if you have any issue with setup, please comment below, We will back to you As soon as possible.
Thank You! 🙂