Chapter 1 of 9

Laravel 13 tutorial #1: install and set up the project

verified on 2 September 2026 · 6 min

Quick answer

Install Laravel 13 with composer create-project laravel/laravel blog, then run php artisan serve. The command creates the .env file, generates the application key and runs the migrations on its own. Laravel 13 requires PHP 8.3 as a minimum and uses SQLite by default.

By the end of this chapter, you will have a Laravel 13 project installed, configured on SQLite, with the welcome page showing in your browser.

This first chapter installs Laravel 13, explains what each folder of the project is for and starts the development server. By the end, the Laravel welcome page shows up in your browser.

What you need

Laravel 13 requires PHP 8.3 as a minimum and accepts PHP 8.3, 8.4 and 8.5. Check your version:

bash
php -v

Only the first line matters. It has to report PHP 8.3, 8.4 or 8.5:

code
PHP 8.4.25 (cli) (built: Aug 27 2026 20:19:39) (NTS)

If the command does not exist or reports an older version, install PHP. On Windows, WampServer or Laragon, on macOS, Homebrew with brew install php, on Linux, your distribution’s php-cli package.

You also need Composer, the PHP dependency manager. It is what downloads Laravel and everything it depends on.

bash
composer --version

PHP extensions

Laravel needs a few PHP extensions. Most installations already ship them. Two are worth checking, because their absence only bites later on:

bash
php -m | grep -E "pdo_sqlite|intl"

pdo_sqlite drives the database used in this tutorial. intl will be required in chapter 4 by the admin panel, installing it now avoids a failed install at that point.

An editor

VS Code is free and more than enough, with the “PHP Intelephense” extension. PhpStorm is paid and understands Laravel out of the box. The tutorial assumes neither: everything happens in the terminal.

Creating the project

Move into the folder where you keep your projects, then run:

bash
composer create-project laravel/laravel blog

Composer downloads Laravel and its dependencies into a blog folder. It takes one to three minutes depending on your connection.

What the command does on its own

Since Laravel 11, create-project does more than download files. It copies .env.example to .env, generates the application key, creates the database/database.sqlite file and runs the initial migrations. The php artisan key:generate and php artisan migrate commands you will find in older tutorials are no longer needed on a fresh project.

Check the installed version:

bash
cd blog
php artisan --version
code
Laravel Framework 13.30.1

The alternative: the Laravel installer

There is a global installer that shortens the command and offers to pick a starter kit:

bash
composer global require laravel/installer
laravel new blog

It is handy if you create projects often, but it adds a global dependency to your machine and sometimes causes a PATH problem. If you get laravel: command not found, the article fixing “laravel: command not found” explains the cure. For this tutorial, composer create-project is enough and spares you the detour.

The project tree

Here is what the blog folder holds. Laravel’s skeleton has become much lighter since Laravel 8: several files described by older tutorials no longer exist.

At the root

app

The code of your application. Right after installation it holds only three files: a base controller, the User model and a service provider. This is where your controllers and models will go.

bootstrap

The bootstrap/app.php file is the configuration point of the application: routes, middleware and error handling are all declared there. In Laravel 8 and 9, that role was spread across app/Http/Kernel.php, app/Console/Kernel.php and app/Exceptions/Handler.php, which are all gone.

config

The configuration files. Laravel 13 only publishes ten of them by default, against about twenty in the past: the others still exist inside the framework with their default values. To pull one out and edit it, use php artisan config:publish.

database

The migrations (the structure of the tables), the seeders (the starting data) and the factories (test objects). It is also where database.sqlite, your database, lives.

public

The only folder the web server should expose. It holds index.php, the entry point for every request, and the files compiled by Vite.

resources

The Blade views, the stylesheets and the JavaScript files before compilation.

routes

The URL declarations. Laravel 13 only creates two files, web.php and console.php. The api.php and channels.php files described in tutorials written for Laravel 8 are no longer created by default: php artisan install:api and php artisan install:broadcasting add them if you need them. This tutorial only uses web.php.

Inside the app folder

Http/Controllers

The controllers: the code that receives a request, fetches the data and picks the view to return.

Models

The Eloquent models. Every table in the database has a matching model used to read from it and write to it. This folder has existed since Laravel 8, in earlier versions the models sat directly in app.

Configuring the project

Everything that depends on the machine lives in the .env file at the root. The files in config read it through the env() function. That file must never be committed: it holds your passwords.

The site name and address

.env
APP_NAME="Mon blog"
APP_URL=http://localhost:8000

APP_NAME will appear in the page titles. APP_URL is used to build absolute links, in particular to uploaded images.

The database

Laravel 13 uses SQLite by default:

.env
DB_CONNECTION=sqlite

SQLite keeps the whole database in a single file, database/database.sqlite. There is no server to start, no user to create and no password to remember. For learning, it is the best choice: delete the file and you start over.

If you prefer MySQL or MariaDB, create the database then replace these lines:

.env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=blog
DB_USERNAME=root
DB_PASSWORD=

The tutorial works with both. One behavioural difference shows up in chapter 8, about the search engine: it is measured and explained there.

Files uploaded from the admin panel land in storage/app/public, which is not reachable from the web. This command creates the symbolic link that makes them visible:

bash
php artisan storage:link
code
INFO  The [public/storage] link has been connected to [storage/app/public].

Starting the server

bash
php artisan serve
code
  INFO  Server running on [http://127.0.0.1:8000].

  Press Ctrl+C to stop the server

Open http://127.0.0.1:8000. The Laravel welcome page appears. Leave that terminal open: the server runs until you stop it.

If port 8000 is already taken, Laravel does not give up: it tries the next one and tells you. Read the address it prints rather than assuming it.

code
  Failed to listen on 127.0.0.1:8000 (reason: Address already in use)

   INFO  Server running on [http://127.0.0.1:8001].

You can also serve the project with Apache, Nginx, Docker or Laravel Herd. In that case the server root must point at the public folder, never at the project root: exposing the root would make your .env file downloadable.

Checking the installation

This command sums up the state of the project and confirms everything is in place:

bash
php artisan about
code
Environment ........................................................
Application Name .......................................... Mon blog
Laravel Version ........................................... 13.30.1
PHP Version ................................................ 8.4.25
Composer Version ........................................... 2.10.3
Environment ................................................. local
Debug Mode ................................................ ENABLED

Drivers ...........................................................
Cache .................................................... database
Database ................................................... sqlite
Queue .................................................... database
Session .................................................. database

The project is ready. The series index recaps what each chapter brings. The next chapter explains how to map a URL to your own code.

Common errors

Port 8000 is already in use php artisan serve does not give up: it moves to 8001 and says so. Read the address it prints instead of assuming it.
The intl extension is missing You do not need it straight away, but the admin panel in chapter 4 requires it. Installing it now avoids a composer failure later.
The server root points at the project Apache or Nginx must serve the public folder, never the root: otherwise the .env file becomes downloadable.
The api.php and channels.php files are missing That is normal since Laravel 11. php artisan install:api and install:broadcasting create them if you need them.
Newsletter

New tests, tutorials and projects, by e-mail.

Reproducible tests, versioned code, dated results. Never any spam.