How to Install Laravel 12
Laravel is one of the most popular PHP frameworks for building web applications. With the release of Laravel 12, developers get improved performance, better security, and new features. In this guide, we’ll show you how to install Laravel 12 on your system step by step.
Prerequisites
Before installing Laravel 12, make sure your system meets the following requirements:
- PHP 8.2 or higher
- Composer (PHP dependency manager)
- Database (MySQL, PostgreSQL, SQLite, or SQL Server)
- Web Server (Apache, Nginx, or Laravel’s built-in server)
If you haven’t installed PHP or Composer yet, follow these steps:
Installing PHP and Composer
Install PHP:
- Windows: Download PHP from windows.php.net or use XAMPP.
- macOS: Use Homebrew:
- Linux (Debian/Ubuntu):
Install Composer:
- Download Composer from getcomposer.org.
- Verify installation by running:
Step 1: Install Laravel Installer
Open a terminal and run the following command to install Laravel globally via Composer:
Make sure the global Composer bin directory is in your system’s PATH.
- Windows: Add
C:\Users\YourUser\AppData\Roaming\Composer\vendor\bin
to system variables. - macOS/Linux: Add this to your
~/.bashrc
or~/.zshrc
file:
Step 2: Create a New Laravel 12 Project
Now, you can create a new Laravel project using:
Alternatively, if you don’t want to install the Laravel installer, you can use Composer directly:
Replace project-name
with your desired project folder name.
Step 3: Navigate to Your Project Directory
Step 4: Start the Laravel Development Server
Run the following command to start the built-in development server:
By default, Laravel will be available at:
👉 http://127.0.0.1:8000
Step 5: Configure Environment Variables
Laravel stores environment settings in the .env
file. You may need to configure your database connection here:
After updating the .env
file, run:
Conclusion
You have successfully installed Laravel 12! 🎉 Now, you can start building your Laravel application. Happy coding!