Preparing the Environment0:06
All right, here we go. All right, so before we can start writing some Laravel code, we first need to get our development environment in order. So let's do that now. So I'm gonna open my browser of choice and visit Laravel dot com slash docs and then we'll come to installation and then all the way to installing PHP in the Laravel installer. Alright, so we can see here, well before you can create a Laravel application,
Alright, so we can see here, well before you can create a Laravel application, you need your environment in order and that environment we'll expect, well, PHP Composer, which is a package and dependency manager, you don't need to worry about that right now. Next, you need the Laravel installer, which is a command line tool that makes it very easy to rapidly construct a new Laravel project.
Installing with Laravel Herd0:43
which is a command line tool that makes it very easy to rapidly construct a new Laravel project. And then also things like Node and NPM. Now, if you're at the beginning of your learning, you might be thinking, oh my gosh, what? What have I gotten myself into? Don't worry. Seriously, don't worry, you got this. Okay, so if you don't want to install these manually, here's what you can do. If we scroll down, there is a dedicated tool called Laravel
to install these manually, here's what you can do. If we scroll down, there is a dedicated tool called Laravel Herd, which is basically a gooey that will encapsulate everything you need to get started. It's an incredible tool and I would highly recommend it. So let's have a look here. All right. Now you'll see there is a free version and also a pro version. Trust me, the free version will be fine for you. Alright, so I'm gonna download it for Mac
Trust me, the free version will be fine for you. Alright, so I'm gonna download it for Mac or of course if you're on Windows, follow those steps and it says Easy as that. So I will drag her to my applications folder and then we'll start it. Alright, so let's go through this together. We need to provide admin permissions. Next, it wants to know, well, where are you gonna store all of your projects?
Next, it wants to know, well, where are you gonna store all of your projects? All of your websites that you build, you can either use the default folder or you can specify your own. The default is fine. All right, so let's give it just a minute. On my machine, it's installing Peach P 8.4, it's going to install Node and NVM, we'll Skip Herd Pro. And believe it or not, we're ready to go.
to install Node and NVM, we'll Skip Herd Pro. And believe it or not, we're ready to go. Pretty amazing stuff. So let's close this out. And if I go up to my toolbar, we can see, sure enough, we're up and running. Here's all of the various services that are ready to go. Cool. So we can go to settings, we can take a look at PHP. We can see I have 8.4 installed, but I could even pull in 8.5 if I want to. So cool. Alright, so next I'm gonna open up my terminal.
Verifying Tools in Terminal2:27
but I could even pull in 8.5 if I want to. So cool. Alright, so next I'm gonna open up my terminal. Now you might have a terminal you prefer to use, or if not, you can stick with the default and then research that a little more in the future. So here's what you might do on the Mac, you might search for terminal and that'll bring up a window just like this. Or maybe you use something like Warp or I term or Ghosty, it doesn't matter. Okay? So I'm gonna pull up mine
or Ghosty, it doesn't matter. Okay? So I'm gonna pull up mine and it looks like this kind of cool. All right, so let's follow the steps. Let's go into that herd folder and let's see what's now available to us. So I can run PHP dash V to check the current version of PHP. That was installed by Herd, and we know it was 8.4, right? And sure enough, 8.4. Next, we learned that there was a Laravel installer,
Creating a New Project3:13
And sure enough, 8.4. Next, we learned that there was a Laravel installer, and we can use it by referencing Laravel. So have a look at this. This is the Laravel installer. Think of it as a way to rapidly scaffold a new Laravel application. All right, so let's go through it together. Let's create a Laravel new project. Laravel new. And now this is going to be basically the folder name. What is the name of the project?
And now this is going to be basically the folder name. What is the name of the project? I'm just gonna call it something generic. Okay, so now we're gonna go through a handful of steps. Now just be careful. You're gonna see a bunch of terms and maybe tooling that you're possibly not aware of. That's totally okay. And those situations, just choose none or skip it entirely. I promise you'll figure out some of this stuff as you go. So in our case, do we wanna start our kit?
I promise you'll figure out some of this stuff as you go. So in our case, do we wanna start our kit? Think of it as like boilerplate to rapidly get up and running. Nah, let's say none. All right, so now that's doing its thing. Next it wants to know, well, how are you gonna connect to a database? So especially at this stage in your learning, but really this will take you a super long way.
So especially at this stage in your learning, but really this will take you a super long way. I would recommend start with sq l sq light is a file-based database. Minimal dependencies, easy to use. Alright, so let's choose that next. Would you like to install dependencies? Yes. Just click yes. All right. And that's it. Congratulations, you have a fresh Laravel project ready to go.
Congratulations, you have a fresh Laravel project ready to go. So real quick, if I scroll up just away, you can see right here, create users table. Create jobs table. So already as part of the installation, it is creating database tables that you can reference in your project. Alright, so cool. So now if I once again run ls,
Viewing Project in Browser4:51
Alright, so cool. So now if I once again run ls, you can see we have a brand new project. I will CD in there with CD project. Once again, if I list the files, here is my Laravel project. All right, so check this out. Here's the coolest thing about herd. Any project that you have in your herd folder can be accessed in your browser by referencing the folder name. Do test. Let's have a look.
accessed in your browser by referencing the folder name. Do test. Let's have a look. The folder is called project test and baa bang, ba boom. How cool is that? You know, I, I've been doing this for many, many years and even to this point, it kind of blows me away how easy it is to get up and running. Alright, so here is the splash page for the framework. You can read the documentation and of course you can
Opening Editor and Routes5:32
Alright, so here is the splash page for the framework. You can read the documentation and of course you can and should watch more Laravel Screencasts. Okay, so now let's wrap up by opening this project within your code editor of choice. And then in the next lesson, we're gonna get to work. Now of course you can use any editor you want, uh, sublime text vs. Code Z cursor, PHP storm, which is my preference. It does not matter in the least.
Code Z cursor, PHP storm, which is my preference. It does not matter in the least. But yeah, like I said, I like Peach B Storm. If you wanna work along with me, you can download it for free here. Okay, so I will close this out, open my editor, and let's open our project within my home directory. Here's that herd folder, and let's open our project. All right, and here we go. So it's a lot of files,
All right, and here we go. So it's a lot of files, but trust me, you're gonna figure it out. So I'm gonna leave you with one file and one file only. I want you to go into Routes Web and notice right here, even though you don't know anything about Laravel yet, you kind of know what's going on here, right? And you're gonna see this pattern repeated over and over. So let's have a look. Routes gets, well,
And you're gonna see this pattern repeated over and over. So let's have a look. Routes gets, well, it almost seems like we're saying, well, when the user visits the homepage, then we're gonna load this view called welcome. And you know what? That's exactly what's going on here. So here's what I want you to do. I want you to play around here. I want you to change the URI and then reload the browser. Does anything change? I then want you to figure out,
I want you to change the URI and then reload the browser. Does anything change? I then want you to figure out, well maybe, maybe that welcome view is located somewhere in here, maybe ooh, if use folder. And I want you to edit that welcome view, and then reload the browser. Get your feet wet, play around, you're not gonna break anything. And when you're ready, let's move on to the next lesson.
you're not gonna break anything. And when you're ready, let's move on to the next lesson.
