Project Overview and Goals0:06
Welcome to the final project for Laravel from scratch. All right, here's the game plan. We're gonna harness all of your learning and together build an app that is simple enough to immediately comprehend, but also complex enough that it'll provide an endless number of examples and learning opportunities. Alright, so here's the key though. I'm gonna show you my exact workflow. This isn't just a tutorial.
I'm gonna show you my exact workflow. This isn't just a tutorial. This is what it would look like if I actually sat down and started to build this thing. So on that note, here's what we're working on Throughout Laravel from scratch, we toyed around with this concept of collecting ideas. So now we're gonna turn it mostly into a real world project that we deploy. It'll support authentication, flash messaging,
project that we deploy. It'll support authentication, flash messaging, notifications, tracking our ideas. Of course, in this case I'm using it to track potential lar cast courses. We can filter them. Here's ones that are completed, maybe ones that are still in progress and ones that are pending, we haven't yet started. Okay? We can review these naturally. Notice we track the state timestamps.
Okay? We can review these naturally. Notice we track the state timestamps. We have a description that supports, uh, markdown parsing. Notice. We can associate images, we can add, uh, to-dos or tasks, which I call steps. We can associate links. We have validation, we have notifications. Uh, there's really quite a bit here. And then of course we can modify the user's profile. Cool. So like I said, it is simple enough
Create New Laravel App1:27
And then of course we can modify the user's profile. Cool. So like I said, it is simple enough to immediately understand, but just complex enough that you're gonna figure out the entire process for how you would build an application with Laravel. Okay? So if you're ready, let's get started. So as always, we're gonna start with Laravel new, Laravel new, and we're gonna call it Idea. And I do wanna use Pest in this case.
Laravel new, and we're gonna call it Idea. And I do wanna use Pest in this case. All right, we have our app. So let's CD in there and we'll open this in my editor. So for this final project, I will actually use the cursor editor. All right, here we go. Of course we have our landing page. This looks great to me. So now of course we should view this in the browser. If we visit idea test, sure enough,
Initialize Git and GitHub2:10
So now of course we should view this in the browser. If we visit idea test, sure enough, we get the familiar landing page. Okay, so now let's perform our initial commit. Let's initialize Git. I will add everything to the staging area and then we will commit with initial commit. Alright, so now if I run a GI log, of course we can see uh, our first commit. That looks great. Alright,
of course we can see uh, our first commit. That looks great. Alright, so here's actually what I wanna do. I'm gonna visit github.com so we can immediately push this up. I will sign in. Now, of course, if you are not familiar with GI or GitHub, it's okay. Just come along for the ride. Alright, so here's our L Cast organization. I will scroll down and create a new repository.
Alright, so here's our L Cast organization. I will scroll down and create a new repository. We will call it idea. I'm gonna keep it private for now and let's create the repository. All right, so let's scroll down. I can copy this right here to add an existing repository. I will paste those lines in. Notice we add the remote origin and then we push it up to GitHub.
Deploy with Laravel Forge3:07
Notice we add the remote origin and then we push it up to GitHub. So now if I switch back, I should be able to give this a refresh. And there we go. Our code is live. So you know what? Since our code is live to the world, why don't we also make the website itself live to the world? Let's push it up to production right now. And to do that I'm gonna reach for Laravel Forge forge dot Laravel dot com.
And to do that I'm gonna reach for Laravel Forge forge dot Laravel dot com. And again, you don't have to sign up here, you just come along for the ride and then we'll get back to the code in just a couple minutes. So I will log in and now that I'm signed in, I can immediately create a server. Why don't we call it Idea? I will use Laravel VPS.
I can immediately create a server. Why don't we call it Idea? I will use Laravel VPS. That's fine. Or your own server. Uh, small should be good enough. Alright, we have a server. Let's build our first site. Laravel. All right, so let's find my repository. We call it idea. So we will connect to the database. We will install our dependencies. This looks great. And notice how fast this is by the way. All right, give it just a second.
And notice how fast this is by the way. All right, give it just a second. Configuring Engine X running the migrations and we're up and running about 15 seconds total. So let's go ahead and run the first deploying. This will pull the changes. We can see the logs right down here and there. We done deployment complete. It's so fast. Okay, so let's go ahead and visit our site. And this is it. We still have that familiar splash page,
Okay, so let's go ahead and visit our site. And this is it. We still have that familiar splash page, but now this is available to the world as I record this in real time. It's pretty cool. Okay, so now let's think about it. We installed Laravel, we initialized Git, we created a repository. We pushed this up to production using Laravel Forge. The next step is to get my general tooling in order. I'll do that now back in my editor.
Set Up Developer Tooling4:52
The next step is to get my general tooling in order. I'll do that now back in my editor. If I pull up the extensions tab, whether you're using Cursor or VS code or winds serve, maybe uh, make sure that you have the Laravel official extension installed. We will use that heavily. Okay, next, if you go to composure Jason, you'll see that it includes pint as a development dependency. This is an an opinionated code style fixer. Basically. For example, if I go to my user model
This is an an opinionated code style fixer. Basically. For example, if I go to my user model and I make some changes here, like let's use double quotes here. Maybe remove the comma, maybe bring the curly brace up here. Well, of course if we run pint, you'll see that it automatically reformats that. No, we're gonna use single quotes only. No, we're gonna have a trailing comma for the last item. And now the curly brace should go here, right?
No, we're gonna have a trailing comma for the last item. And now the curly brace should go here, right? You get the idea. Okay? So that's something I'm gonna use as well. Next, if I go into my composer Jason file, if I scroll to the very bottom, you'll see there are various scripts that I can run. I can say Composer, run test, and you'll see that'll run my tests. And then we have some automatic scripts
and you'll see that'll run my tests. And then we have some automatic scripts that run at various stages in the lifecycle, like after you update Composer. Now, the cool thing is you can create your own if you want. For example, I could say format and maybe this is going to defer to Pint. So I can run our pint command. So check this out. If I switch back to the terminal, now I can run Composer run format
If I switch back to the terminal, now I can run Composer run format and you'll see it runs Pint on my entire project. Cool. So now we have an alias of sorts. I can add any number of commands that should be run anytime I trigger Composer format. For example, another tool I like to use is called Rector. Rector is a free tool that will scan and update and upgrade your PHP code. So I'll give you a quick example.
and upgrade your PHP code. So I'll give you a quick example. Here's uh, a various snippet. We have a final demo file class, we have some checks here. And if I run it though, here are the changes it made. So notice it added the necessary types. So if you wanna write modern PHP, uh, as it exists today, then Rector can help you get there. And of course right here and notice that value should be a Boolean.
And of course right here and notice that value should be a Boolean. It should set the return type. So here are the various rules that it applied, and of course I believe there's over a hundred rules that it scans for. So it really is an essential tool for any real project you're working on, in my opinion. So let's get that set up. I'll go to the docs
So let's get that set up. I'll go to the docs and we will install it, paste that in. All right, so now we should be able to run vendor Ben Rector or just Rector. And of course at this point it doesn't have a configuration file, so I will create one now. Cool. So now you will find that in your project route within the sidebar. If I scroll down, where are you? There we go. Rector PHP.
within the sidebar. If I scroll down, where are you? There we go. Rector PHP. Alright, so it scans our paths and has some initial settings that later we will update. So there's actually one other tool I wanna pull in. And this is basically a Laravel optimized, uh, plugin for Rector. It's called Rector Laravel. And it's just gonna scan for some more, uh, Laravel specific things and upgrades it can run.
And it's just gonna scan for some more, uh, Laravel specific things and upgrades it can run. So I'm gonna grab this in the process and once again you can see how we can configure it. Cool. Paste that in. Alright, so yes, of course you can review these on your own, but we're trying to go quick here. So I'm gonna save you a step back to my config. I'm gonna paste in a new version like so. Okay, so very quickly we're gonna skip a handful of folders
I'm gonna paste in a new version like so. Okay, so very quickly we're gonna skip a handful of folders that we don't care about. We're gonna skip certain rules that I don't necessarily need here. Uh, again, you don't need to know what these are if you're doing it on your own. If you run into something you don't like, you can ignore it. Uh, after seeing which rule was applied from the command line PHP sets, we're gonna pull in the Laravel set provider.
Uh, after seeing which rule was applied from the command line PHP sets, we're gonna pull in the Laravel set provider. This is all stuff that you'll just copy from the documentation. So don't get bogged down here trying to figure out what all of this does. You can mostly copy and paste your way, uh, to the configuration that you want. The key things are to check for dead code and code quality where we can do early returns.
The key things are to check for dead code and code quality where we can do early returns. I want strict types, which means it's gonna add this to the top of all of my various files. You get the idea and this will be available in the source code. Cool. So now we can run Rector on a project like this Rector. All right, so notice it modified 26 files and yeah, mostly to start, this is going to add strict types
All right, so notice it modified 26 files and yeah, mostly to start, this is going to add strict types to the top of all of the appropriate files, which generally in 2025 when I record this is a, is a pretty good practice. It's gonna make sure that, um, you're strict about your types and you're not accidentally passing a string to something that expects a number, which can sometimes lead to bugs. Okay, so now if we return to composer, Jason, let's return to our scripts and where we have format,
Okay, so now if we return to composer, Jason, let's return to our scripts and where we have format, I can now add a reference to Rector. And actually, why don't we do Rector before Pint? So we run Rector on the entire code base, and when that's done, we can run pint. Cool, right? So now let's give it a shot, composer, run format. All right, it's running Rector and then it runs pint. So yeah, you can get in this habit
Add Code Review and AI Tools10:15
All right, it's running Rector and then it runs pint. So yeah, you can get in this habit of automatically triggering this or manually triggering it whenever you're about to perform a commit. Next step, I'm gonna pull in a tool called Code Rabbit, which provides very high level, super intelligent code reviews for each commit you make. And trust me, it's gonna spot endless little things that you might've forgotten. Whether it's a potential security vulnerability
that you might've forgotten. Whether it's a potential security vulnerability or an area attribute you forgot, or a security best practice that you are not following, I consider it an essential tool. So I'm gonna pull that in for this project. And notice we can try this out in our IDE by pulling it in as an extension for Cursor or VS code. Now I've already done that, which means you'll see a little code rabbit icon right here.
Now I've already done that, which means you'll see a little code rabbit icon right here. And notice here's all the various files that we can review before we make our next commit. Cool. So as a guideline, we will reach for this before each commit or at the end of each lesson in this final project. Alright, next up I'm gonna pull in Laravel Boost. This is a first party package that provides AI assisted development
This is a first party package that provides AI assisted development by providing essential context and structure that AI needs to generate high quality Ville specific code. Basically it, it includes all the various tooling and server so that AI can be as knowledgeable about your project as it can possibly be. If you're building a Ville app and you're using ai, you have to pull this in.
If you're building a Ville app and you're using ai, you have to pull this in. It's an essential tool. Alright, so let's do it together, paste that in. And now I can run PHP Artisan Boost install. Alright, so what editor, again, just pick the one you're using. In this case I might stick with Cursor and Peach B Storm. Pick your agents that you like to use and now notice all of the various guidelines it's adding.
Pick your agents that you like to use and now notice all of the various guidelines it's adding. It's scanning your project to see, all right, looks like you're using Pint and Tailwind and Pest and Laravel. Let's provide guidelines, specific guidelines tailored to those projects that AI can review before it implements or offers any advice to your project. So if I switch back to Cursor, let's enable Laravel Boost. And if you don't see those little popups, you should be able
So if I switch back to Cursor, let's enable Laravel Boost. And if you don't see those little popups, you should be able to open the uh, command prompt and look for maybe MCP server. Yes, here we go. And you can see I have three enabled. If yours is not, just click that little checkbox and you'll be all set to go. So now for example, if I were to pull up an AI panel, let's ask it what tools and my project are available to you?
let's ask it what tools and my project are available to you? And we can see a massive list here. So if I scroll up, it is aware of Laravel Boost and it knows how to search the documentation to learn more. It can run commands, it can run Tinker, it can trigger database query, it checks the browser logs. So I could say things like the last request triggered an error in the logs, review it and make the fix, right? These are now all available to you.
error in the logs, review it and make the fix, right? These are now all available to you. I can say, which routes do I currently have registered? And it provides the response. It looks like we have a homepage, a health check, and an Inspire command. You get the idea. Alright, so let's go ahead and wrap up by adding everything to the staging area, and I'm gonna say add various tooling.
and wrap up by adding everything to the staging area, and I'm gonna say add various tooling. We're still sort of in the initial setup stage. But yeah, think about everything that we accomplished in this reasonably short video. We created a Laravel project, right? We initialized Git, we pushed it up to GitHub, we sent it over to Forge and deployed an actual app in real time that's available to the world.
and deployed an actual app in real time that's available to the world. Next we set up tooling like Pint and Rector. We set up a composer script, we reviewed Code Rabbit support, and then we pulled in Laravel Boost and we set up our AI MCP servers. So it's a lot there. You don't have to do all of it for your project, but again, this is what I would do in actual real life
You don't have to do all of it for your project, but again, this is what I would do in actual real life and generally it's what I'd recommend for you as well. Alright, so if you're ready, let's actually start coding in the next episode.
