Laravel

How to Install Laravel Valet on Windows OS

February 27, 2018

author:

How to Install Laravel Valet on Windows OS

Developing Environment is a primary need for any developer to develop and deploy the applications. Today we will learn and install one such environment called Valet in Windows 10 Operating System.

# What is Valet?

Valet is a development environment for Laravel. One of the reasons its so famous is because it runs without Nginx and Apache. It uses DnsMasq on Mac OS, and Acrylic DNS on Windows 10 to proxy all the request s to *.test domain, i.e., no more /etc/hosts and stuff like Vagrant.

We know most of the development environments are tricky to install for the first time and this whole process can really be time-consuming. But, you can totally count on using Valet if you are someone who wants faster installations and minimal requirements. It’s the best bet for systems with less RAM as it approximately uses only 7MB of RAM. It also enables local sites to be shared publicly with the help of local tunnels. Also, Valet is not only limited to Laravel, but it also supports:

  • Laravel
  • Lumen
  • Drupal
  • CakePHP
  • Magento
  • Symfony
  • WordPress
  • Joomla
  • Zend
    & more..

# Prerequisites

Before we dive into installation steps, it is necessary to discuss some of the requirements that must be matched to install Valet on Windows:

# Install Valet in Windows

It was initially available only for iOS, but today with the help of a third party package, we can install Valet on Windows. We will valet-windows package.

Also, make sure that your system isn’t running any programs that bind port 80 (like Apache or Nginx). And run the commands shown below as Administrator.

  • Step 1:
    Install Valet globally with:
composer global require cretueusebiu/valet-windows
Install valet for windows
  • Step 2:
    Next, configure Valet and register Valet’s daemon. This is to launch Valet automatically on system startup.
valet install
Configure Valet and register Valet’s daemon for Windows OS

The installation is completed, but we aren’t yet done.

# Windows Configuration

We need to configure Acrylic DNS proxy usage manually. So follow the below steps carefully:

  • Step 1:
    Go to Control Panel -> Network and Internet
Select network and internet to install Valet
  • Step 2:
    Within Network and Sharing Center, Go to View network status and tasks
Install Laravel Valet in Windows, Step 2
    • Step 3:
      Click on Change Adapter settings
Install Laravel Valet in Windows, Step 3
  • Step 4:
    Right Click on your network and click on Properties
    Install Laravel Valet in Windows, Step 4
  • Step 5:
    From Networking tab, select Internet Protocol Version 4 (TCP/iPV4) and click on Properties button
Install Laravel Valet in Windows, Step 5
  • Step 6:
    Enable Use the following DNS server addresses option and set 127.0.0.1 as the Preferred DNS server. And click on OK button.
Install Laravel Valet in Windows, Step 6
  • Step 7:
    From Networking tab, select Internet Protocol Version 6 (TCP/iPV6) and click on Properties button.
Install Laravel Valet in Windows, Step 7
  • Step 8:
    Again, Enable Use the following DNS server addresses option and set ::1 as the Preferred DNS server. And click on OK button.
Install Laravel Valet in Windows, Step 8

Congratulations, Valet is successfully configured on your Windows system.

# Laravel Install for Valet

In the previous steps, we completed installing and configuring Valet on the machine. Hence you can now start working on your Laravel (or any other) projects right away. But if you haven’t yet installed Laravel, go through it quickly:

Install Laravel globally with the composer:

composer global require "laravel/installer"
Installing Laravel with Valet

# Working on Laravel with Valet

Creating a new Laravel application is simple and universal. For instance:

laravel new hashvel-blog
Installing Laravel with Valet

Park Directory:

This is typically useful if you store all your Laravel projects in a single directory. Run the following command from that specific directory:

valet park

You can now create new Laravel application in this namespace and open it in the browser. For instance, http://app-name.test

Link Project:

If you are looking to run a specific project without park command, you can link this project to valet with:
valet link app-name
e.g., valet link hashvel-blog

Link laravel project with valet

The linked projects are located in C:/Users/Username/.valet/Sites
Working with Laravel in Valet

And here’s how you can view in the browser:
Run Laravel Project with Valet

# Important Valet Commands

• Install Valet:

iOS:

composer global require laravel/valet

Win:

composer global require cretueusebiu/valet-windows

• Upgrade Valet:

valet stop
valet uninstall
composer global require laravel/valet
OR
composer global require cretueusebiu/valet-windows

• Restart/Start Valet:

valet restart
valet start

• Register a working directory

valet park

• Remove a “parked” directory from the parked directory list

valet forget

• View all “parked” paths

valet paths

• Navigate project / Create Symbolic link

valet link app-name

• Destroy Symbolic link

valet unlink app-name

• Secure Laravel

valet secure laravel

• Unsecure Laravel

valet unsecure laravel

• Share local site with all

valet share

• Stop sharing

Control + C

Parting Thoughts:
This post was power-packed with the configuration of Valet specifically for Win users. We started with and overview of Valet and then inclined towards its installation and Network configurations. Later, we also installed Laravel on the machine, crafted a new Laravel application and ran it in the browser. In the end, we talked about some essential Valet commands that a developer must be familiar with.

Hope you installed Valet and Laravel on your system successfully. Go ahead and create your dream Laravel application!

Questions & Comments:

Thank you for coming this far. If you run through any errors while installing Valet in your Windows system, post them in the comment section below.

Leave a comment

Your email address will not be published. Required fields are marked *