Introducing Laravel Valet0:00
In a world where programmers struggle with slow and confusing development environments, one tool rises above the rest. You try to make sense of how to configure your environment. It may seem that you are trapped in an endless loop, but you are no longer alone. Free of burdens and constraints, all may be stored and recognized here. Relax. Feel free. Everything works. It's time to just drive. Welcome. In this series, we're going to cover Laravel Valet, a tool for serving your sites on your local machine. It takes a single folder and treats it as your application, serves it up to your local browser, and it works on macOS, but there are also forks for Windows and Linux. Valet works by installing a suite of tools on your machine and pre-configuring each of them so that they talk to each other, and that way a single request, for example, myapp.test here,
Install Options: Valet vs Herd0:57
and Linux. Valet works by installing a suite of tools on your machine and pre-configuring each of them so that they talk to each other, and that way a single request, for example, myapp.test here, is routed immediately through to the appropriate code base on your local machine. Valet itself is a tool in the command line you can install with composer, and which manages its dependencies through a tool called Homebrew. But there's also a tool called Laravel Herd that bundles Valet and all of its dependencies up in a single downloadable, so if you don't want to deal with Homebrew, you don't actually have to. So let's take a look at the simplest use case for Valet. I'm going to create a brand new Laravel app for my company, a hot new startup called Floga. And there we go. If we cd into Floga, we can see that we have our entire application up and ready to run there. But how are we going to serve it? Well, with Valet, because I've already attached
Serving a New App1:39
And there we go. If we cd into Floga, we can see that we have our entire application up and ready to run there. But how are we going to serve it? Well, with Valet, because I've already attached Valet to my site's directory, we simply go over to Chrome, and we go to floga.test, and there we go. Brand new Laravel application. So let's say I wanted to make a quick change here. We can simply open up the directory for Floga. Let's say we wanted to add a picture about goat yoga in there. So we got goatyoga.jpg, and now we can go over to our editor, and we can open up the welcome file. Let's just replace out the logo real quick and just throw in the image. Old school. Okay, so we go over here, we hit refresh, and nothing else is going on. We didn't have to spin up any extra servers, nothing else happened other than we made some edits, we changed some files in the local file system, and we've immediately seen the changes in our
Live Editing and .test Domains2:28
have to spin up any extra servers, nothing else happened other than we made some edits, we changed some files in the local file system, and we've immediately seen the changes in our local browser. So you can see the power here. This is the very beginning, but you can make the simplest changes. You can spin up as many applications as you want, and each folder that they're living in, whether it's a Laravel app or a WordPress app or whatever else, just gets shown as foldername.test, ready for you to debug live in your browser. And while I have been the primary maintainer for Valet for years at this point, I do need to acknowledge that I did not originally write it. It was actually originally created by Taylor Otwell and Adam Wathen out of a desire to make it easier and faster for them to spin up local development environments when they were working on new Laravel apps. If you're interested to hear a little bit more or have a good laugh,
Next: Install and Deep Dive3:02
make it easier and faster for them to spin up local development environments when they were working on new Laravel apps. If you're interested to hear a little bit more or have a good laugh, you can take a look at Introducing Laravel Valet, the little mini commercial that Adam shot for Valet. So now that we've covered the basics of what Valet is, let's dive deeper into how to install it, how to use it, and how it works under the hood.
