What to expect in the next generation of Laravel Forge. Read the blog post
Rewatch this lesson
Courses
/
Getting Started with Laravel
/
Setting up your Laravel project

Next video in… 10

Your first route

Setting up your Laravel project

Getting Started with Laravel

Setting up your Laravel project
Install Laravel, PHP, and create your first Laravel project. Learn about Laravel's AI-friendly design and get your development environment ready.

Alright, let's start by setting up your first Laravel project! I know you're excited to start coding, and trust me, we're going to get there fast. Whether you're on macOS, Windows, or Linux, the official Laravel docs at laravel.com have you covered with clean instructions and a one-line command that you can paste into your terminal to get started. No need to hunt down PHP or Composer separately—this single command handles everything for you.

A Quick Note About Laravel and AI

Before we dive in, I want to take a quick timeout to talk about Laravel and AI. Laravel is designed to work beautifully with AI assistants. In fact, the framework includes Laravel Boost, which is a powerful tool that bridges the gap between AI coding agents and Laravel applications. It detects what's installed in your application and then allows those AI assistants to work with Laravel exactly the way you'd expect.

While I won't be using AI assistants or even AI auto-complete for this course (I want you to see and understand every line we write), Laravel and AI do make a fantastic pairing. You can ask AI to help explain concepts, debug issues, or even generate boilerplate code. Just remember: the easiest way to learn is by writing it out yourself, or at least understanding what the code does if AI is helping you write it. Understanding what the code does is always more important than who writes it!

Step 1: Install Laravel and PHP

Head over to the installation section of the Laravel documentation and follow the instructions for your operating system. What's great about this is that the single command there will install PHP, Composer, and the Laravel installer all in one go—everything you need to get started.

After running that command, and this is important, quit and restart your terminal session to make sure everything that was installed is available globally. Trust me, this saves a lot of "command not found" headaches.

Want to check if everything worked? Try these commands:

php -v

This shows your PHP version, and:

laravel -v

This confirms the Laravel installer is ready (I'm running version 5.17 in the video).

Now, if you already had PHP and Composer installed previously, you could just install the Laravel installer globally with:

composer global require laravel/installer

For a fully-featured, graphical PHP installation and management experience, check out Laravel Herd—it's a fantastic tool that makes PHP management a breeze.

Step 2: Create a New Laravel Application

With everything installed, you're ready to create your Laravel application! I have a Code directory where I like to put all my projects, but you can run the Laravel installer wherever you see fit. Here's the magic command:

laravel new chirper

The installer's going to ask you a few questions. Here's what to pick (and yes, we're sticking with the defaults for most of this):

  • Starter Kit: Choose "None"—we're going to build things ourselves for now so you understand what's happening under the hood

  • Testing framework: Just leave it with the default options (we won't be touching testing in this course, but it's good to have)

  • Database: Select sqlite—it's perfect for getting started quickly, no configuration needed

  • Run npm install? Say "yes" to let Laravel install the JavaScript dependencies for our application

Once that's done (and you'll see "Application ready!" in your terminal), jump into your new project folder:

cd chirper

That's it! The application is ready in the chirper directory.

Step 3: Set Up Your Editor

I'm going to be using VS Code as my editor of choice for this bootcamp, but here's the good news—it doesn't really matter what you use. You can use any text editor or IDE you like, and Laravel works great with all of them.

Some popular choices include:

  • VS Code and Cursor: Both have an official Laravel extension for syntax highlighting and productivity boosts. The Laravel official extension works great with VS Code or any VS Code forks like Cursor.

  • PHPStorm: If you prefer a more dedicated IDE, PHPStorm is a favorite among PHP and Laravel developers. It even has its own Laravel Idea plugin, which is free for PHPStorm users.

No matter what you pick, you're set for a smooth ride. Pick what you're comfortable with!

Step 4: Explore the Project Structure

Now that we have our Laravel application up and running, let's take a quick, high-level overview of the project structure that the Laravel installer generated for us—even without selecting a starter kit, there's quite a bit here!

Inside your chirper folder, here are the main directories you'll be working with:

  • app/ — This is where your PHP code lives—things like models and controllers are going to go here. We'll talk a lot more about those as the course progresses.

  • resources/views/ — This is where your views are going to go. In other words, where does your HTML go? You can think of these Blade templates as HTML with a little bit of extra magic and superpowers on top.

  • routes/ — This is where we define our application's URLs. When a user hits a particular page in your application, what should happen? This is where you define that behavior.

  • database/ — Everything database-related lives here. The neat thing about this directory is because we selected SQLite in the application installer, we have a database specifically just as this one file: database.sqlite. But this directory is also where things like our migrations are going to go, telling our database what structure it should have.

All of this might look like a lot now, but you'll be navigating these folders with ease very soon. I just wanted to let you know that there's really only going to be a couple of them that we'll spend the majority of our time in, so don't check out just yet!

Step 5: Start Your App

Alright, moment of truth! Let's get this application up and running. Since all your dependencies are already built (remember when we said yes to npm install?), we can kickstart the development process with one beautiful command:

composer run dev

What this does is magic—it starts the development server for us. You might have noticed in the output that not only do we have our assets ready to go at a specific Vite port, but we also have our app URL for this Laravel application.

This command gets everything moving at once:

  • Laravel's local development server

  • The queue worker (for background jobs)

  • Vite development server (for your frontend assets)

Open up http://localhost:8000 in your browser, and you should see the Laravel welcome page. We're using Laravel 12 for this current version of the Laravel Bootcamp, and if you see that welcome page, congratulations—you're ready to start building!

We have our application, we have it open in our text editor, and we have our development server up and running to see any of the changes that we make. I think we're ready to get building!

Next up: you'll create your very first route and view, and get something custom showing up on your new Laravel site.

00:00
Let's start by setting up your first Laravel project.
00:02
To do that, we'll start at the [email protected].
00:05
So whether you're on Mac os, windows, or Linux, laravel dot com's documentation
00:11
has clean instructions and a one line command that you can paste
00:15
into your terminal to get started.
00:17
What this does is if you don't have PHP and Composer installed, or even the
00:21
Laravel installer, this will install all of that in one simple command for you.
00:26
Since I already have it installed, I'm gonna skip the step.
00:28
One easy way to see if everything worked is if you type PHP dash V for the version
00:33
of PHP that we just installed, or even the Laravel dash V, which will say that,
00:38
Hey, you have the Laravel installer, and in this case I have 5.17 up and running.
00:44
Now I will note that if you did have PHP and Composer installed previously,
00:48
you could use this composer Global, require Laravel installer command
00:53
to get this up and running as well.
00:54
After running that command, you might have to quit and restart your terminal session
00:59
in order to make sure everything that installed is available for you globally.
01:03
I'll go ahead and do just that,
01:05
And so we're ready to go.
01:06
I have a code directory that I like to put all of my projects in, but you can run the
01:11
Laravel installer wherever you see fit.
01:14
I'm gonna type Laravel new, and then I'm gonna call this chipper.
01:17
We're not gonna use a starter kit for right now, and while we won't be touching
01:20
testing in this course, I'm just going to leave it with the default options.
01:24
Again, we're gonna use the default options for this course.
01:27
So SQLA is perfect.
01:28
And you guessed that we'll stick with the default options.
01:31
So running NPM install in order to install the JavaScript
01:35
dependencies for our application.
01:36
And look at that.
01:37
The application is ready in the chipper directory.
01:39
So we're going to move into that directory with CD chipper.
01:43
I'm gonna clear out this terminal, and you might have seen that.
01:45
Last note.
01:46
In order to get this application up and running, we can use Composer, run Dev.
01:50
What this does is it kickstarts the development process.
01:54
The development server for us.
01:56
So not only do we have our assets ready to go at a specific V port,
02:00
but then we also have our app URL, for this larva application.
02:05
I'm gonna open this up in our browser.
02:07
And there we go.
02:08
We're using Laravel 12 for this current version of Laravel Bootcamp.
02:12
With our Laravel application up and running, why don't we take a
02:14
look at the code that the Laravel installer generated for us, even
02:18
without selecting a starter kit.
02:19
I'm gonna be using VS code as my editor of choice for this bootcamp.
02:23
But the good thing is it doesn't really matter.
02:25
You can use any text editor or IDE that you like.
02:28
Laravel works great with all of them
02:30
some popular choices include things like VS Code and Cursor, which neatly,
02:34
both of which have their own extension.
02:37
Specifically for Laravel, this is the Laravel official extension.
02:41
It works great with VS code or any kind of VS.
02:45
Code forks like cursor.
02:46
If you prefer a more dedicated I-D-E-P-H-P storm is a favorite among PHP developers
02:51
and Laravel developers, but no matter what you pick, you're set for a smooth ride.
02:55
Even PHP Storm has its own Laravel idea plugin, which is
02:59
free for users of PHP Storm.
03:02
Before we get any further, I do wanna take a quick timeout
03:05
to talk about Laravel and ai.
03:08
Laravel is designed to work beautifully with AI assistance.
03:10
In fact, the framework includes Laravel Boost, which is a powerful
03:15
tool that bridges this gap.
03:16
Between AI coding agents and Leva applications, it detects what is installed
03:22
in your application and then allows those AI assistance to then work with it Everly
03:29
while providing documentation as well as just being able to interact with your Leva
03:33
application the way you expect you would interact with the Laravel application.
03:39
So while I'm not going to have any AI assistance or even ai uh, auto complete
03:44
turned on for this course, AI and Laravel does make a fantastic pairing.
03:49
And if that's something that you would like to do, I would recommend
03:52
checking out Laravel Boost.
03:54
It's not going to be an integral part of this course.
03:58
You can ask AI to help explain some of these concepts and debug
04:01
issues, and I might make notes of where Laravel Boost helps when
04:05
we're building out this application.
04:07
But just remember, the easiest way to learn is being able to write
04:11
it out yourself or at least have a better understanding of if AI
04:14
assistants are writing this for you, um, how does it actually work?
04:19
Now, as we get back into it, I do want to give you a quick, high level
04:22
overview of the project structure that the Laravel installer generated for us.
04:27
We have our chirp directory.
04:29
That's where we, uh, installed this application.
04:32
And in here we have app.
04:34
Code, and this is where your PHP code, things like models
04:37
and controllers are gonna go.
04:39
We'll talk a little bit more about those as the course progresses.
04:43
Then I wanna direct your attention to this resources directory.
04:47
This is where your views are going to go.
04:50
In this case, where does your HTML go?
04:54
You can think of these blade templates as HTML with a little bit of extra
04:59
magic and superpowers on top.
05:02
And then we have this routes directory.
05:05
This is where we can define our applications URLs, or when a user
05:09
hits a particular page in your application, what should happen?
05:13
And then lastly, this database folder.
05:15
Now the neat thing about this directory is because we selected SQL Light in
05:19
the application installer, we have a database specifically just as this
05:24
one file database does SQL Light.
05:26
But in this directory is also where things like our migrations are going to go as
05:30
well, telling our database what happens.
05:33
And again, we'll dive into all of this at a later time throughout this course.
05:37
I just wanted to give a high level overview of.
05:40
All of this and what it actually looks like, the things that you're usually
05:45
going to take time and spend time in within a layer file application.
05:50
All of this might look like a lot now, but you'll be navigating
05:53
these folders with ease very soon.
05:56
I just wanted to let you know that there's really only going
05:58
to be a couple of them that will spend the majority of our time in,
06:01
so don't check out just yet.
06:03
So we have our application, we have it open in our text editor, and then we also
06:06
have our development server up and running to see any of the changes that we make.
06:10
I think we're ready to get building.