How to install Valet (Laravel) on Windows 10?
Want to work on Laravel- World's #1 for PHP development framework platform but don't know how to install its development environment- Valet on Windows 10 machine?
Well, then here you can have quick steps to refer and try on your own.
First What is Valet?
Valet is the development environment for Laravel. Its super easy and requires no etc/host file or any sort of big configuration. You can publish your sites publically using local configurations.
Valet is famous because it is independent of Aparach or Nginx. It uses DnsMasq on Mac OS and Acrylic DNS on Windows. Earlier it was only available for Mac OS users but now its open for Windows users as well.
Acrylic DNS is used to proxy all request to *.test domain so we wont need any host files to get configured.
It is also famous for the fact of faster installations with minimal requirement.
Valet also supports Drupal ,Joomla, Zend apart from Laravel. Here you will know how to install Valet for Laravel.
For that your system needs to have:
1. PHP installed.
2. Composer installed.
Following are few quick steps how to install Valet, follow it and you can really build something amazing on your own.
1. Run cmd as an administrator.
2. Run the command - composer global require cretueusebiu/valet-windows to install it globally.
3. Run valet install
This will install Valet on your machine.
Now we need to do some basic windows configurations for Acrylic DNS
1. Go to Control Panel - Network and Internet
2. Open Network Status and Tasks
3. Go to Change Adapter Settings
4. Click on Wifi and right click to get Properties.
5. In Properties - Network Tab - double click on Internet Protocol Version 4 (TCP/iPV4)
6. Choose - Use the following DNS server addresses and set 127.0.0.1 as Preferred DNS server. Click OK.
7. Similarly ouble click on Internet Protocol Version 6 (TCP/iPV6)
8. Choose - Use the following DNS server addresses option and set ::1 as the Preferred DNS server. Click OK.
Now you need to be in the folder where you will be running your laravel application from. Go to that folder in cmd.
Now if you dont have laravel installed on your machine install it from
1.composer global require "laravel/installer"
2. Make new application using - laravel new yoursitename
3. Then run- valet park - This will register the current working (or specified) directory with Valet
4. Run - valet link - This will link the current working directory to Valet
5. Run - valet secure yoursitename - this will secure the given domain with a trusted TLS certificate
Go in browser and type yoursitename.test - You will be landed on your laravel page :)
Welcome to CE, @Anna . Thank you for the detailed steps. I do work on Laravel as well. I use Mac and Valet works beautifully on it.
I had faced problem installing it on Windows, and I might give this guide a try. Just out of curiosity - does Valet on Windows run the '.dev' domain?
Thanks @Kaustubh for information. I tried using .dev domain from Valet but got stuck into configuration issues with it as it has become gTLD (Generic Top Level Domain).
That why Chrome or Firefox forces all domains ending with .dev to redirect to HTTPs which gives you error. Also nginx do not serve https urls.
Thus I suppose .test domain is safe and its also a reserved domain for testing.
Lately I came to know that .dev is one of the 100s of gLTDs bought by Google.
@Anna - Google owns the .dev domain and that's one of the reasons Chrome has issues with https and .dev domains. I think Google has fixed most of those problems allowing developers to have .dev domains on their local machines.
I think the problem is specific to Windows machines. I'd recommend installing Laragon in place of Valet for Windows. It seems to have addressed all those issues. Have you tried that yet?