Laravel is a powerful PHP framework for web application development. This guide will walk you through installing Laravel 11 using two different methods: the Laravel Installer and Composer.


Prerequisites

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

  • PHP 8.2+
  • Composer (PHP dependency manager)
  • Node.js & npm (for frontend assets)
  • Database (MySQL, PostgreSQL, or SQLite)

Install Laravel

Install Laravel Using Laravel Installer

composer global require laravel/installer
laravel new client
cd client

OR

Install Laravel via Composer

mkdir client
cd client
composer create-project laravel/laravel .

Set Up Environment Variables

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

Open the .env file in the root of your project and update it to suit your needs. Make sure to replace the placeholder values with your actual configuration details.

APP_NAME="YourAppName"
APP_URL=http://localhost

Run database migrations:

php artisan migrate

Install Frontend Dependencies

Laravel uses Vite for asset bundling. Install and build frontend assets:

npm install
npm run build

Now, you can start the Laravel application using:

php artisan serve

By default, the application will be available at: http://127.0.0.1:8000

You have successfully installed Laravel 11! 🎉 Now you can start building your application.