in this Laravel tutorial, We’ll explore valet, which is a development environment for macOS minimalists. It’s a lightweight Laravel development environment that uses approximately 7 MB of RAM.
Laravel Valet configures your Mac always to run Nginx in the background when your machine starts. You can use DnsMasq – is a Valet proxies for all requests on the *.test
domain to point to sites installed on your local machine.
It’s an alternative of Sail or Homestead tool for local Laravel environments. You can even share your sites publicly using local tunnels.
You can also access Laravel Valet on github: https://github.com/laravel/valet.
Please make sure your machine satisfies the following requirements before proceeding with the valet installation:
macOS
operating systemmacOS
.Let us take you step-by-step through the process of setting up your development environment, installing Valet, and configuring it for Laravel.
Please make sure that Homebrew is running and up to date using the update command. Open Terminal and run the following command to update Homebrew:
brew update
Let’s install composer(php package manager) using the below command:
brew install composer
Make sure the Composer global bin directory is in your system’s $PATH
:
export PATH="$PATH:$HOME/.composer/vendor/bin"
Next, you should use Homebrew to install PHP:
brew install php
Check PHP version:
php -v
Finally, You can install Laravel Valet as a global Composer package:
composer global require laravel/valet
Now, install all dependencies of valet by running the following command:
valet install
This command will configure and install Valet and DnsMasq
Valet allows you to switch PHP versions using the valet using the below command.
valet use php@8.1
Or by using .valetrc
file, You need to create this file in the root of your project.
php=php@8.1
In case you don’t already have one, open your projects folder and start a new Laravel project:
laravel new my-laravel-project
Open the command line and navigate the directory where you store your Laravel projects, and run the following command:
valet park
The above command will automatically detect and serve any Laravel projects within this directory.
Visit http://my-laravel-project.test
in your web browser. Valet automatically creates a secure URL for your Laravel project.
We have successfully installed and configured Laravel Valet into your Mac system. You can develop, test, and deploy Laravel applications easily by using this tutorial. You can refer to the official Laravel Valet documentation: https://laravel.com/docs/8.x/valet.
This tutorial helps integrate a PHP SDK with Laravel. We'll install aws-php-sdk into laravel application and access all aws services… Read More
in this quick PHP tutorial, We'll discuss php_eol with examples. PHP_EOL is a predefined constant in PHP and represents an… Read More
This Laravel tutorial helps to understand table Relationships using Elequonte ORM. We'll explore laravel table Relationships usage and best practices… Read More
We'll explore different join methods of Laravel eloquent with examples. The join helps to fetch the data from multiple database… Read More
I'll go through how to use soft delete in Laravel 10 in this post. The soft deletes are a method… Read More
in this Laravel tutorial, I will explore common practices for using the Laravel Blade template with examples. Blade is a… Read More