A hosts file is a simple text file that maps IP addresses to domain names. When you type a domain name into your browser, your computer checks the hosts file to see if it has an IP address for that domain. If it does, it uses that IP address to connect to the server. If it doesn't, it will use a DNS server to look up the IP address.
When you're developing locally, you'll be using domain names like laravel.dev.test instead of localhost. This is important because it allows you to mimic real-world environments and allow you to test your application with 3rd party services.
To configure your hosts file on macOS or Linux, you'll need to edit the /etc/hosts file. You can do this by running the following command in your terminal:
sudo nano /etc/hosts
This will open the hosts file in the nano text editor. You'll see a list of IP addresses and domain names. To add a new entry, simply add a new line at the bottom of the file with the IP address followed by the domain name. For example:
127.0.0.1 laravel.dev.test
127.0.0.1 mailpit.dev.test
127.0.0.1 vite.dev.test
127.0.0.1 reverb.dev.test
127.0.0.1 meilisearch.dev.test
Press CTRL + O (that's an "oh" not a zero) to save the file, then press Enter to confirm the filename. Press CTRL + X to exit nano.
SESSION_DOMAIN variable within your .env file to what you choose for your development domain. ex: SESSION_DOMAIN=laravel.dev.testTo configure your hosts file on Windows, you'll need to edit the C:\Windows\System32\drivers\etc\hosts file. You can do this by editing the file in Notepad. You'll need to run Notepad as an administrator to edit the file.
To do this, open up the Start menu and search for Command Prompt. Right-click on Command Prompt and select "Run as administrator".

Once you have a command prompt open, you can run the following command to open the hosts file in Notepad:
notepad C:\Windows\System32\drivers\etc\hosts
This will open the hosts file in Notepad. You'll see a list of IP addresses and domain names. To add a new entry, simply add a new line at the bottom of the file with the IP address followed by the domain name. For example:
127.0.0.1 laravel.dev.test
127.0.0.1 mailpit.dev.test
127.0.0.1 vite.dev.test
127.0.0.1 reverb.dev.test
127.0.0.1 meilisearch.dev.test
Press CTRL + S to save the file, then close Notepad.
Once you've added the entries to your hosts file, you can test by ping the domain name in your terminal or command prompt. For example:
ping laravel.dev.test
You should see the IP address 127.0.0.1 in the output. This means your hosts file is configured correctly.
Configuring DNS records for your app
One of the most foundational parts of the Internet is using the Domain Name System (DNS) to map domain names to IP addresses. This allows you to use human-readable domain names like `example.com` instead of remembering IP addresses. This guide will show you how to configure DNS records for your app.
Connecting to your database
Connecting to your database with a GUI manager like TablePlus or Sequel Ace is a must for many developers. This guide will walk you through how we can connect to your database in development and production.