Laravel 12 is the latest version of the most popular PHP framework, widely used for creating robust, scalable web applications with ease. This guide walks you through a simple yet professional step-by-step process for installing and setting up Laravel 12.
What You'll Need:
- PHP (version 8.2 or higher)
- Composer installed
- A local development environment (XAMPP, WAMP, Laragon, or Docker)
Step 1: Verify PHP and Composer
Check PHP version:
php -v
Verify Composer installation:
composer --version
Step 2: Install Laravel 12
Use Composer to create a new Laravel 12 project:
composer create-project laravel/laravel:^12.0 my-laravel12-app
Navigate to your new project:
cd my-laravel12-app
Step 3: Run Your Laravel Application
Serve your Laravel application:
php artisan serve
Open your browser and visit:
http://localhost:8000
Step 4: Setting Up Database (Optional)
Edit your .env
file to configure your database connection:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database_name
DB_USERNAME=your_username
DB_PASSWORD=your_password
Run migrations:
php artisan migrate
Step 5: Laravel Breeze (Authentication Setup - Optional)
Quickly set up authentication with Laravel Breeze:
composer require laravel/breeze --dev
php artisan breeze:install
npm install
npm run build
php artisan migrate
Conclusion
Congratulations! You've successfully installed and set up Laravel 12. You're now ready to explore and build powerful web applications.