Why use Laravel 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
Installation requirements for Laravel Valet on Windows 10
You must first have
- PHP 7+
- If your system doesn’t have PHP, make sure to install the latest version of PHP before installing Valet.
- Composer for Windows
- You must install Composer to install Valet.
Install Valet in Windows with Composer
Here is the command to install Laravel Valet globally:
composer global require cretueusebiu/valet-windows
Next, configure Valet and register Valet’s daemon. This is to launch Valet automatically on system startup.
valet install
Windows Acrylic DNS Proxy Configuration
We need to configure Acrylic DNS proxy usage manually. So follow the below steps carefully:
- Step 1:
- Go to Control Panel -> Network Connections
- Step 2:
- Right-click your network connection
- Click Properties
- Click Internet Protocol Version 4 (TCP/IPv4)
- Click Properties
- In the Internet Protocol Version 4 (TCP/IPv4) Properies window
- Check Use the following DNS server addresses:
- Enter 127.0.0.1
- Click OK
- Check Use the following DNS server addresses:
- Right-click your network connection
- Step 3:
- Right-click your network connection
- Click Properties
- Click Internet Protocol Version 4 (TCP/IPv4)
- Click Properties
- In the Internet Protocol Version 6 (TCP/IPv6) Properies window
- Check Use the following DNS server addresses:
- Enter ::1
- Click OK
- Check Use the following DNS server addresses:
- Right-click your network connection
Setting your parked directory for Laravel Valet
Navigate to root code folder and run this command:
valet park
If you run this on the wrong folder and want to unpark
valet forget
Laravel Install for Valet with Composer
In the previous steps, we completed installing and configuring Valet on the machine. Now, you can now start working on your Laravel (or any other) PHP, HTML, or JavaScript projects right away. However, you haven’t yet installed Laravel, so use this command to install it globally.
composer global require "laravel/installer"
Make a New Laravel App
Creating a new Laravel application is simple and universal.
Navigate to your root web folder and use this command:
laravel new app
View your new Laravel project
Open a web browser and visit the following url
http://app.test
Where is the nginx/php error file?
The default Laravel Valet error log files can be found here:
C:\Users\USERNAME\.config\valet\Log\nginx-error.log
or
Start -> %USERPROFILE% -> .config -> valet -> Log -> nginx-error.log
Replace USERNAME with your username.
Optional Laravel Valet commands
Secure the Laravel Valet Application
NOTE: Only do this on the C: drive. It can cause major problems when used on another drive.
valet secure app
Unsecure the Laravel Valet installation
valet unsecure app
Sharing your Laravel Valet app with the world using ngrok
Use these commands to share your app with the world:
cd app
valet share
It will tell you the live URL that you can share with your friends.
Using Another Domain with Valet
By default, Valet serves your projects using the .dev TLD. If you'd like to use another domain, you can do so using the valet domain tld-name command.
For example, if you'd like to use .app instead of .dev, run valet domain app and Valet will start serving your projects at *.app automatically.
Uninstalling Laravel Valet
valet uninstall
These are my notes from a screencast found here:
https://laracasts.com/lessons/laravel-valet-is-the-bomb
Upgrading Laravel Valet
You may update your Laravel Valet installation using this command in your terminal
composer global update
After upgrading Composer, it is good practice to run this command
valet install
Running this command allows Laravel Valet can make additional upgrades to your configuration files if necessary.
Laravel Valet for Mac OS X
https://github.com/laravel/valet
Laravel Valet for Ubuntu / Linux
https://github.com/cpriego/valet-ubuntu
https://packagist.org/packages/jmarcher/valet-linux
Laravel Valet for Windows 10
Windows port of the popular development environment Laravel Valet.
-
If you don't have Composer installed, make sure to install it.
-
Install Valet with Composer via
composer global require cretueusebiu/valet-windows
. -
Run the
valet install
command. This will configure and install Valet and register Valet's daemon to launch when your system starts. -
If you're installing on Windows 10, you may need to manually configure Windows to use the Acrylic DNS proxy.
Laravel Valet configures your Windows to always run Nginx in the background when your machine starts. Then, using Acrylic DNS, Valet proxies all requests on the *.dev
domain to point to sites installed on your local machine.
https://github.com/cretueusebiu/valet-windows