Contents
- 1. System Requirements
- 2. Install Composer
- 3. Install Laravel Installer (Optional)
- 4. Create a Laravel 12 Project
- 5. Navigate to Your Project
- 6. Configure Environment File
- 7. Set Up Your Database
- 8. Run Laravel Development Server
- 9. Install Frontend Dependencies (Optional)
- 10. Common Errors & Fixes
- Final Thoughts
- FAQs
Want to install Laravel 12 but don’t know where to begin? You’re in the right place.
If you’re new to PHP frameworks, the setup part can feel confusing—Composer, environment files, database config… It’s a lot at first. But once you go through it step by step, it actually makes sense.
This guide will walk you through installing Laravel 12 from scratch in a way that’s easy to follow—even if it’s your first time.
1. System Requirements
Before installing Laravel 12, make sure your system meets the minimum requirements:
- PHP 8.2 or higher
- Composer (latest version)
- MySQL or any supported database
- Node.js & npm (optional but recommended)
Check your PHP version:
php -v
2. Install Composer
Laravel depends on Composer to manage its dependencies.
If you haven’t installed it yet:
- Download Composer from the official website
- Install it on your system
- Verify installation:
composer -V
3. Install Laravel Installer (Optional)
This step is optional but makes things easier:
composer global require laravel/installer
Once installed, you can create projects faster using a simple command.
4. Create a Laravel 12 Project
You have two ways to install Laravel:
Option A (Recommended)
laravel new my-app
Option B (Using Composer)
composer create-project laravel/laravel my-app
Both will install the latest Laravel version (Laravel 12).
cd my-app
6. Configure Environment File
Laravel uses a .env file for settings.
Copy the example file:
cp .env.example .env
Generate application key:
php artisan key:generate
7. Set Up Your Database
Open the .env file and update:
DB_DATABASE=your_db_name
DB_USERNAME=root
DB_PASSWORD=your_password
Run migrations:
php artisan migrate
8. Run Laravel Development Server
Start the server:
php artisan serve
Open in browser:
http://127.0.0.1:8000
If everything worked, you should see the Laravel welcome page.
9. Install Frontend Dependencies (Optional)
If your project uses frontend tools:
npm install
npm run dev
10. Common Errors & Fixes
Composer Not Found
Make sure Composer is added to your system PATH.
Permission Errors (Linux/Mac)
chmod -R 775 storage bootstrap/cache
Port Already in Use
php artisan serve --port=8001
Final Thoughts
Installing Laravel 12 might feel overwhelming at first—but once you’ve done it, it becomes much easier the next time.
If this is your first Laravel setup, don’t worry if something doesn’t work immediately. Most issues come down to small configuration mistakes.
Take it step by step, and you’ll get there.
FAQs
Is Laravel 12 beginner-friendly?
Yes. It has a learning curve, but the documentation and community support make it manageable.
Do I need PHP knowledge first?
Basic PHP helps, but you can learn alongside Laravel.
Can I install Laravel without Composer?
No—Composer is required to install and manage Laravel.
