Here’s a step-by-step tutorial on how to install the latest version of Laravel (as of 2025) on your local development machine. Laravel is a popular PHP web application framework known for its elegant syntax and developer-friendly tools.
🔧 Prerequisites
Before installing Laravel, make sure the following are installed on your system:
✅ 1. PHP 8.1 or higher
Laravel 10+ requires PHP 8.1+. You can check your PHP version with:
php -v

If not installed, visit: https://www.php.net/downloads
✅ 2. Composer
Laravel uses Composer (a PHP dependency manager). Check if it’s installed:
composer -V

If not, install from: https://getcomposer.org/download/
✅ 3. Web Server (Optional for development)
Laravel comes with a built-in dev server.
You can also use Apache or Nginx with MySQL/PostgreSQL if needed.
🚀 Installing Laravel (Latest Version)
🟢 Method 1: Using Laravel Installer
Step 1: Install Laravel Installer Globally via Composer
You have to enable the zip extension from the php.ini file before executing the following command. Ensure Composer’s global bin directory is in your system’s PATH.
composer global require laravel/installer

Step 2: Create a New Laravel Project
laravel new firstapp

This creates a new Laravel project in a folder named firstapp. After running the command, different types of questions will appear. You have to select the correct options based on your Laravel application.
Step 3: Serve Your Application
cd firstapp php artisan serve

Visit: http://localhost:8000 in your browser.
🟠 Method 2: Using Composer Directly
If you prefer not to install the Laravel installer:
Step 1: Create Project Using Composer
composer create-project laravel/laravel firstapp
This installs the latest Laravel version.
Step 2: Run Development Server
cd firstapp php artisan serve
⚙️ Optional Configuration (Recommended)
🔹 .env Setup
Laravel uses an .env file for environment config. Most is pre-configured, but you may want to set:
APP_NAME="My Laravel App" APP_URL=http://localhost:8000 DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=your_database DB_USERNAME=your_username DB_PASSWORD=your_password
🔹 Database Setup (MySQL Example)
1. Make sure MySQL is running.
2. Create a database via phpMyAdmin or command line:
CREATE DATABASE your_database;
3. Update .env with the correct DB credentials.
🧪 Testing the Installation
To confirm Laravel is working:
Open your browser and go to: http://localhost:8000
You should see the Laravel welcome page.
You can also test routes:
// In routes/web.php Route::get('/hello', function () { return 'Hello, Laravel!'; });
Visit http://localhost:8000/hello to see the output.
📦 Useful Laravel Commands
php artisan serve #Start local server php artisan make:controller TestController #Create a controller php artisan make:model Post -m #Create model and migration php artisan migrate #Run migrations php artisan route:list #List all routes
🧹 Troubleshooting
Problem Solution
laravel not found #Ensure ~/.composer/vendor/bin is in your PATH
Permission denied #Try chmod -R 755 your_project
php version too low #Install PHP 8.1 or above
📝 Conclusion
You’ve now installed Laravel and set up your development environment! 🎉
You can now start building modern PHP applications with:
Routing
MVC structure
Authentication
Artisan CLI
Eloquent ORM