Skip to content

Vendor-neutral, engineer-written explanations. Clear definitions first, then practical steps with real examples — no fluff.

How to install laravel?

SB
Written by StageBit Engineering Team
Updated January 2026 0 min readVerified by engineers

Laravel is a modern PHP framework designed for building secure, scalable, and maintainable web applications. Below are the correct and up-to-date steps to install and set up a Laravel 12 project in 2026 on Windows, macOS, and Linux.

System Requirements (Laravel 12)

  • PHP 8.2 or higher (PHP 8.3 / 8.4 recommended for better performance)
  • Composer (latest version)
  • Node.js & npm (for frontend assets and Vite)
  • SQLite, MySQL, or PostgreSQL

Install Required Software

Windows

  • Install PHP 8.3+ or use Laravel Herd (recommended)
  • Install Composer from getcomposer.org
  • Install Node.js (LTS)
  • Optional: Enable WSL2 for Linux-based tooling

macOS

  • Install Laravel Herd (recommended)
  • Composer and PHP are included with Herd
  • Install Node.js (LTS)

Linux

  • Install PHP via apt, dnf, or pacman
  • Install Composer globally
  • Install Node.js (NodeSource or distro packages)

Create a New Laravel 12 Project

The Laravel Installer is the recommended way to create new projects in Laravel 12. It automatically configures the environment file, application key, and database.

laravel new example-app

During installation, you will be prompted to choose:

  • Database (SQLite, MySQL, PostgreSQL)
  • Starter kit (None, Blade, Livewire, React, Vue)
  • Testing framework (Pest or PHPUnit)

Project Environment Configuration

In Laravel 12, the installer automatically creates the .env file and generates the application key. No manual setup is required for new projects.

You may review or adjust settings later inside the .env file if needed.

Database Setup

SQLite (Default and Recommended for Local Development)

If SQLite is selected during installation, Laravel automatically configures and manages the database file.

DB_CONNECTION=sqlite

If the database file does not exist, Laravel will offer to create it automatically when running migrations.

MySQL Example

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

Run Database Migrations

If migrations were not executed during the installation wizard, run:

php artisan migrate

Start the Development Environment

Laravel 12 provides a unified development command that runs the PHP server, Vite, and background services together.

composer dev

The application will be available at: http://localhost

Docker Setup Using Laravel Installer (Optional)

For Docker-based development, Laravel 12 recommends using the installer flag instead of manual Sail commands.

laravel new example-app --docker

After installation, start the containers:

cd example-app
./vendor/bin/sail up

Recommended Next Steps

  • Learn routing, controllers, and middleware
  • Understand Eloquent ORM and migrations
  • Use Blade, Livewire, or Inertia for UI
  • Build frontend assets with Vite
  • Explore authentication starter kits

Was this answer helpful?

Your feedback helps us improve our answers.

Still need help?

Talk to our Laravel experts

We've handled GDPR/CCPA compliance for dozens of EU & US Laravel.

Talk to Laravel Experts

Tell us more about your brand!

Rohit Kundale, Our VP of Sales and Marketing is ready to meet with your team.