Laravel Installation

Laravel installation takes only a few commands once PHP and Composer are on your machine. Laravel 11 requires PHP 8.2 or newer, Composer, and optionally Node.js for compiling frontend assets with Vite.

Requirements

  • PHP 8.2+ with extensions like mbstring, openssl, pdo and xml
  • Composer, the PHP package manager
  • Node.js and npm (for Vite, Tailwind and frontend assets)
  • A database: SQLite works out of the box; MySQL or PostgreSQL for production
  • Tip: Laravel Herd (macOS/Windows) installs PHP, Composer and a local server in one step

Create a New Laravel Project

Use either Composer directly or the official Laravel installer. The installer asks interactive questions such as starter kit, testing framework and database.

# Option 1: Composer
composer create-project laravel/laravel blog

# Option 2: Laravel installer
composer global require laravel/installer
laravel new blog
Creating a "laravel/laravel" project at "./blog"
...
INFO  Application ready in [blog]. You can start your local development using:
  cd blog
  php artisan serve

Run the Development Server

Open http://127.0.0.1:8000 and you will see the Laravel welcome page. Run npm install and npm run dev in a second terminal if you use Vite assets.

cd blog
php artisan serve
INFO  Server running on [http://127.0.0.1:8000].
Press Ctrl+C to stop the server

The .env Configuration File

The .env file in the project root holds settings that change per environment: app URL, debug mode, database credentials and API keys. Never commit it to Git; commit .env.example instead.

APP_NAME=Blog
APP_ENV=local
APP_DEBUG=true
APP_URL=http://localhost:8000

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=blog
DB_USERNAME=root
DB_PASSWORD=secret
(Read in code with env('DB_DATABASE') inside config files, or config('database.default') elsewhere)

Check Your Installation

php artisan --version
php artisan migrate
Laravel Framework 11.30.0

   INFO  Running migrations.
  0001_01_01_000000_create_users_table ........ 12ms DONE
  0001_01_01_000001_create_cache_table ......... 4ms DONE
  0001_01_01_000002_create_jobs_table .......... 6ms DONE

Frequently asked questions

How do I install Laravel 11?

Install PHP 8.2+ and Composer, then run composer create-project laravel/laravel app-name, cd into the folder and start it with php artisan serve.

What is the APP_KEY in Laravel?

A random key used to encrypt cookies and sessions. It is generated automatically on install; if missing, run php artisan key:generate.

Do I need XAMPP for Laravel?

No. php artisan serve is enough for development, and SQLite needs no database server. XAMPP or Herd are optional conveniences.