Install & Configure Laravel 13 from Scratch – Full Beginner Tutorial

             Laravel 13, released on March 17, 2026, is a stability-focused upgrade from Laravel 12 with zero breaking changes, a first-party AI SDK, PHP Attributes for cleaner model and component configuration, and exciting additions like passkey authentication, JSON:API resources, and native vector search support. In this guide, you'll learn exactly how to install Laravel 13 from scratch, configure your environment, and launch your first application.

How to Install Laravel 13: Complete Step-by-Step Guide for Beginners

Table Of Content

1 Prerequisites

Before installing Laravel 13, ensure you have the following prerequisites installed on your system:

1. PHP ≥ 8.3

Laravel 13 requires PHP version 8.3 or higher (supports up to PHP 8.5).

Check with:

        
        php -v
        
    

If PHP is not installed, install it using Homebrew (macOS), apt/yum (Linux), or use tools like XAMPP, Laragon, Laravel Herd, or WampServer on Windows.

2. Composer

Laravel uses Composer to manage its dependencies.

Check Composer:

        
        composer -v
        
    

Install Composer: https://getcomposer.org/download/

3. Database (Optional but recommended)

You can use MySQL, PostgreSQL, SQLite, etc.
For development, SQLite is now the default, but MySQL remains the most commonly used in production.

4. Node.js & npm: Used for frontend dependency management with Vite.
5. Web Server: Apache or Nginx is recommended (or use Laravel Herd for local development).

2 Introduction

Here's a detailed step-by-step guide to install Laravel 13, even if you're fairly new to Laravel or PHP development. This will take you through setting up your environment, installing Laravel, and running your first app. Laravel 13 was announced live at Laracon EU 2026 by Taylor Otwell with a clear promise: zero breaking changes, a stable AI SDK, and carefully chosen improvements that make development cleaner.

3 What's New in Laravel 13?

1. First-Party Laravel AI SDK

Laravel 13 introduces the official Laravel AI SDK, providing a unified API for text generation, tool-calling agents, embeddings, audio, images, and vector-store integrations. Build provider-agnostic AI features with a consistent, Laravel-native developer experience.

    
    use App\Ai\Agents\SalesCoach;

    $response = SalesCoach::make()->prompt('Analyze this sales transcript...');
    return (string) $response;
    
2. PHP Attributes for Configuration

PHP 8 Attributes replace the need for class properties like $table, $hidden, $fillable, and more on your models. This also applies to listeners, notifications, mailables, and broadcast events.

    
    #[Table('users', key: 'user_id', keyType: 'string', incrementing: false)]
    class User extends Model
    {
        // No need for $table, $primaryKey properties
    }
    
3. JSON:API Resources
  • First-party JSON:API resources handle resource object serialization, relationship inclusion, sparse fieldsets, links, and compliant response headers automatically.
4. Passkey Authentication
  • Passkey support is now integrated into the official starter kits and underlying Laravel Fortify, enabling passwordless authentication out of the box.
5. Native Vector Search Support
  • Build AI-powered semantic search using PostgreSQL + pgvector directly from the query builder:
    
    $documents = DB::table('documents')
        ->whereVectorSimilarTo('embedding', 'Best wineries in Napa Valley')
        ->limit(10)
        ->get();
    
6. Queue Routing by Class
  • New Queue::route() method lets you define default queue/connection routing rules for job classes from a single location in a service provider.
7. Teams in Starter Kits
  • The new starter kits bring team-based multi-tenancy back with URL-based routing. You can operate two different team contexts in separate browser tabs.
8. Enhanced Request Forgery Protection
  • New PreventRequestForgery middleware adds origin-aware request verification while preserving compatibility with token-based CSRF protection.
9. PHP 8.3+ Required
  • Laravel 13 drops support for PHP 8.2, requiring PHP 8.3 or higher. This unlocks typed class constants, json_validate(), JIT optimizations, and the #[Override] attribute.
10. Improved Developer Experience (DX)
  • Cleaner scaffolding with Symfony 7.4/8.0 components
  • More expressive code generation
  • Removed legacy polyfills and backward-compatibility layers
  • Better error messages and helpful Artisan commands

4 Create / Install a Laravel Project

4.1 Install Laravel Using Composer

Option A: Using the Laravel Installer (Recommended)
If you don't have PHP and Composer installed, use the quick-start command:
macOS:

/bin/bash -c "$(curl -fsSL https://php.new/install/mac/8.4)"

Windows (Run as Administrator):

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://php.new/install/windows/8.4'))

Linux:

/bin/bash -c "$(curl -fsSL https://php.new/install/linux/8.4)"

Then create a new Laravel project:

laravel new my-laravel-app

The installer will prompt you to select your preferred testing framework, database, and starter kit.
Option B: Using Composer Directly
Open your terminal and run:

composer create-project laravel/laravel:^13.0 my-laravel-app

Move Into the Project Directory:

cd my-laravel-app

Set File Permissions (Linux/macOS):

chmod -R 775 storage bootstrap/cache

Configure .env File
Copy the .env.example file and configure environment variables:

cp .env.example .env
php artisan key:generate

4.2 Configure MySql Database

Update the .env with your database credentials:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel13
DB_USERNAME=root
DB_PASSWORD=

Make sure the database exists before running migrations. Note: Laravel 13 uses SQLite as the default database. To use MySQL, update the DB_CONNECTION value in your .env file.

Run Migrations (Optional)
If you want to create the default tables Laravel provides:

    php artisan migrate

5 Folder Structure

app/

Holds the core application code:

  • Console/ - Artisan commands
  • Exceptions/ - Custom exception handling
  • Http/ - Controllers, middleware, requests
  • Models/ - Eloquent models
  • Providers/ - Service providers

This is where most of your custom logic lives.

bootstrap/

Contains the app.php file which bootstraps the framework. The cache/ folder stores compiled files for faster loading.

config/

All your configuration files — database, queue, mail, app, etc. Each aspect of Laravel is configurable here.

database/

Organized into:

  • migrations/ - Schema definition files
  • factories/ - Model factories for testing and seeding
  • seeders/ - Seed classes to populate your database
public/

The web server points here. It contains the index.php front controller and assets like images, CSS, and JavaScript.

resources/

Where your frontend lives:

  • views/ - Blade templates
  • css/, js/ - Frontend assets (with Vite)
  • lang/ - Optional language files
  • markdown/ - If using markdown-based notifications
routes/

Contains all your route definitions:

  • web.php - Routes for web (session/cookie)
  • api.php - Stateless API routes
  • console.php - Artisan commands
  • channels.php - Broadcast channel routes
storage/

Used for file storage:

  • app/ - Local files
  • framework/ - Cached views, sessions, etc.
  • logs/ - Application logs
vendor/

Composer-managed dependencies. You don't edit this — it's managed automatically.

Other Key Files
  • artisan - CLI tool for managing Laravel
  • composer.json - PHP dependency list
  • package.json - JS dependencies (for Vite)

6 Run Laravel Server to Test the App

Start your server with:

php artisan serve

Or use the dev Composer script to start the development server, queue worker, and Vite simultaneously:


composer run dev

Your application will be available at http://localhost:8000

7 Conclusion

You've successfully installed Laravel 13! This release brings the first-party AI SDK, PHP Attributes for cleaner configuration, passkey authentication, native vector search, and JSON:API resources — all with zero breaking changes from Laravel 12. Explore the official documentation at laravel.com/docs/13.x, try a starter kit with team support, or integrate the AI SDK into your next project. Happy coding!
Revathi M - PHP and CodeIgniter Developer

Written by Revathi M

PHP Developer & Technical Writer · 10+ years building web applications with CodeIgniter and Laravel

Revathi specializes in PHP backend development, authentication systems, and REST API design. She writes practical, production-tested tutorials at Get Sample Code to help developers build secure applications faster.

Frequently Asked Questions

Laravel 13 requires PHP 8.3 or higher (supports up to PHP 8.5). Check your version with 'php -v'.

Run 'composer create-project laravel/laravel:^13.0 my-laravel-app' to create a new project. Alternatively, use the Laravel installer with 'laravel new my-laravel-app'.

You need PHP ≥ 8.3, Composer installed, an optional database like MySQL or SQLite, Node.js and npm for frontend assets, and a web server like Apache or Nginx (or Laravel Herd for local development).

Copy '.env.example' to '.env' using 'cp .env.example .env', then update database credentials and other settings.

Run 'php artisan key:generate' after setting up the .env file.

Edit the .env file with DB_CONNECTION=mysql, DB_HOST=127.0.0.1, DB_PORT=3306, DB_DATABASE=your_database, DB_USERNAME, and DB_PASSWORD. Note that SQLite is the default database in Laravel 13.

After configuring the database, run 'php artisan migrate' to create the default tables.

Run 'php artisan serve' from the project directory to start the server at http://localhost:8000. You can also use 'composer run dev' to start the server, queue worker, and Vite simultaneously.

Laravel 13 includes the first-party AI SDK for text generation and agents, PHP Attributes for model configuration, JSON:API resources, passkey authentication, native vector search support, queue routing by class, and team-based multi-tenancy in starter kits.

No, Laravel 13 has zero breaking changes from Laravel 12. The upgrade is straightforward and estimated at about 10 minutes for most applications. You can also use Laravel Shift for automated upgrades.