[FREE] Laravel 11 For Beginners: Your First Project

Install Laravel: Composer or Laravel Installer

In this first lesson, we will create a new project with Laravel. The official Laravel documentation installation page has a lot of information. There is more than one way to install Laravel.

The official Laravel documentation is mainly based on a tool called Laravel Sail, which is based on Docker. But we won't be using Sail in this course. To use it, you must know at least the basics of Docker. And we don't want unnecessary prerequisites for beginners, right?

My personal preference is to use Laravel installer.

But before we use the installer, we need to prepare your machine.

Preparing Your Computer: Composer and Web-Server

To install Laravel, you must first install composer on your machine. Composer is later used to install every Laravel package.

Next, you need to have a PHP web server on your machine. There are different "bundle" tools for different operating systems that include Nginx/Apache, PHP, MySQL, and a few more things for PHP web-projects:

  • Laravel Herd (MacOS)
  • Laravel Valet (MacOS/Linux)
  • Laragon/XAMPP (Windows)
  • etc.

On my machine, I will be using Laravel Valet as this is my preferred way.

Notice: Laravel 11 requires at least PHP 8.2 version.

Install and Launch Laravel

First, we need to install the Laravel Installer globally.

composer global require laravel/installer

Then, we can use the command laravel new example-app to create a new Laravel project: the folder example-app will be created automatically with the Laravel files inside.

Let's create a new project.

laravel new project

This command will create a new Laravel project inside a project folder.

Because I am using Laravel Valet, it will automatically generate a domain project.test, which I can immediately launch in the browser.

When the installer is executed, there are a few options to choose from:

  • Starter kit: For now, don't choose any starter kit like Breeze or Jetstream. We will talk about them later in this course.
  • Testing framework: For now, for this course, the testing framework (PHPUnit or Pest) doesn't matter. We will talk about testing in separate other courses.
  • DB Engine: Choose SQLite, MySQL, or other DB engine depending on which you want to work with.

Laravel uses SQLite as a default SQL database engine. After the Laravel project is created, the SQLite database is created automatically in the database folder, with the DB structure built from the Migration files (we will talk about migrations later).

Now, when we visit http://project.test in the browser, we can see the default Laravel welcome page.

If you open the project in the code editor and specifically the routes/web.php file, you will see one Route is defined.


use Illuminate\Support\Facades\Route;
Route::get('/', function () {
return view('welcome');

Here we have a / homepage, which leads to a View called welcome. Views are found in the resources/views folder.

So that's it, we installed Laravel!

In the next lesson, let's talk about how to create pages: how the routing and the views work.


Hello, Thank you so much foe your knowledge sharing. Your cources are really usefull. I would like to ask you to make more video cources. We have laravel documentation and a lot of written information in internet. I think your cources uniquqe, among other reasons, because of the way you explain information by voice. Thank you


Hello, thank you for the kind words. Unfortunately, video courses are a bit harder to make and they get outdated very quickly. We are currently switching to more text based courses with a goal to update them as soon as possible


I'm happy with text based courses, I find them much better to learn with than video's, I constantly have to pause and rewind videos, whereas I can just go at my own pace with written ones, so keep it up :)


For me text is better than video.


Thanks for this


im getting PRAGMA foreign_keys = ON;


Will there be more information about laravel with docker?


No plans, there are many information about docker already free and


i can't thank you more for this precise explanation step by step. Take my gratitude for helping me understand better this framework.

🥳 1

If I choose mysql during creation, it says an error. SQLSTATE[HY000] [1049] Unknown database 'lara3' (Connection: mysql, SQL: select * from sessions where id = mbjCq72FwwjL8w2cutWBmY4IKcPdEoUTVTvgdz17 limit 1) How to fix the error?


Create database lara3 or change database to the one you have


Before I create the new project, do I have to create the database in phpMyAdmin? And if I don't want the same database name as the project name?