How to Install Laravel 12 and create project with composer
When you’re starting with Laravel development, the very first thing (and maybe the most important) is to set up your environment the right way. Laravel is a PHP framework that powers thousands of apps worldwide, from small APIs to big enterprise platforms. But before you can actually build something, you gotta install Laravel, check its version, and run your first project on Windows.
This guide will show you system requirements, how to install Laravel, how to check which version you got, how to run old projects, and also create new ones. By the end, you’ll have Laravel running on your Windows and enough confidence to move forward with real projects.
Laravel Installation Requirements on Windows
Before creating a Laravel project, you need to make sure your computer has the necessary tools installed and configured. Since Laravel is based on PHP and uses Composer for managing its dependencies, you’ll also need a database server and, optionally, Node.js for handling frontend assets. Let’s go through the setup one step at a time:
(i). PHP (Version 8.1 or Higher)
Laravel requires PHP 8.1 or above. Older versions won’t support the latest Laravel features.
Check if PHP is installed
Open Command Prompt (CMD) or PowerShell and type:
php -v
If PHP is available, you’ll see something like:
Installing PHP on Windows
The simplest way is to install XAMPP or WAMP, which bundle PHP with Apache and MySQL.
For Simple Laravel installation we need Xampp to download
(ii). Web Server (Apache or Nginx)
Laravel needs a server environment to run. On Windows, you have a few options:

-
XAMPP (Beginner-Friendly)
Comes with Apache, PHP, and MySQL in one package. After installation, open the XAMPP Control Panel and start Apache + MySQL. Download from official website apachefriend.org
Your local server will then be available at:
-
WAMP
Another easy option for Windows users who prefer a native tool. -
Manual Setup
You can also install Apache or Nginx separately and configure PHP manually, but for beginners, XAMPP or WAMP is much simpler.
(iii). Composer (Dependency Manager for PHP)
Laravel uses Composer to install and manage all its packages.
Check if Composer is already installed:
Example output:
Install Composer on Windows:

-
Visit getcomposer.org.
-
Download Composer-Setup.exe.
-
During setup, select PHP’s
php.exe(e.g.,C:\xampp\php\php.exe). -
Complete the installation and restart CMD.
-
Verify with:
(iv). Database (MySQL, MariaDB, or PostgreSQL)
Most Laravel apps run on MySQL or MariaDB.
- Using XAMPP/WAMP:
If you installed XAMPP or WAMP, MySQL is already included. You can manage it with phpMyAdmin at:
(v). Node.js and NPM (For Frontend Build Tools)
Laravel uses Vite or Laravel Mix to compile CSS and JavaScript. These tools require Node.js and NPM.
-
Check if Node.js is installed:
-
Install Node.js:
Download it from the Node.js official website.
Choose the LTS (Long-Term Support) version for stability.
After installation, confirm with:
(vi). Git (Optional but Recommended)
If you plan to use GitHub or version control, you’ll need Git installed.
-
Install Git on Windows:
Download it from git-scm.com. -
Verify installation:
Step 1: Create Laravel project with composer
The most common way to install Laravel is with Composer. It automatically handles all the dependencies for you.
Open CMD or PowerShell and run:
This will create a Laravel project named myproject.
Or if you installed the Laravel Installer globally, you can even use:

Once it’s done, you’ll see a fresh Laravel folder structure.
Step 2: Running Your First Laravel Project
Move into your new project folder:
Then start the Laravel development server:
You’ll see something like:

It’s always good to check which Laravel version you’re running. Few ways to do that:
Artisan Command
or
Composer Command
Directly in Code
Open:vendor/laravel/framework/src/Illuminate/Foundation/Application.php
and check the VERSION constant.

Step 3: Adding Bootstrap to a Laravel Project (Optional)
Most devs add Bootstrap right away. Install it with NPM:
Then import it in resources/js/app.js.
Step 4: Laravel database connection with mysql
TO connect Database with website first we have to make following changes in .env file

after that we should add a new database file into mysql
Laravel has migrations to manage database tables easily.
Apply migrations:
This keeps your DB version-controlled and sharable with others.

⭐How to install laravel globally in windows
Apart from composer create-project, you can try:
Laravel Installer
Composer with Custom Version
These are common in professional setups, so good to practice them too.
⭐How to run old laravel project
If you grab a Laravel project (maybe from GitHub or from a friend), do this:
-
Put the project files on your system.
-
Run
composer install(downloads dependencies). -
Copy
.env.exampleto.envand set your DB. -
Run
php artisan key:generate. -
Run
php artisan migrate(if database is needed). -
Finally, run
php artisan serve.
⭐Frequently Asked Questions (FAQs)
Q1: Can I run Laravel on XAMPP or WAMP?
Yes, just put the project inside htdocs (XAMPP) or set virtual hosts (cleaner way).
Q2: What’s the difference between Composer and Laravel Installer?
Composer downloads Laravel directly. Laravel Installer is a global tool that makes project creation faster.
Q3: How to install Laravel on macOS without XAMPP or WAMP?
MacOS users usually don’t need XAMPP or WAMP. Instead, you can use Homebrew to install PHP, MySQL, and Composer directly on your system. After that, you can create and run Laravel projects just like on Windows.
Q4: How to install laravel in ubuntu/Linux?
On Linux, you can install Laravel by first installing PHP, Composer, and MySQL using the package manager (apt for Ubuntu/Debian). Then run:
The process is very similar to Windows and macOS, except you use terminal commands instead of installers.
Q5: Are the project creation and running steps the same across all operating systems?
Yes. Once PHP and Composer are installed, the commands to create a Laravel project (composer create-project laravel/laravel myproject) and run it (php artisan serve) are the same on Windows, macOS, and Linux.
Q6: Do I need Node.js and NPM on macOS/Linux for Laravel?
Yes, if you want to use Vite or Laravel Mix for compiling CSS/JS. The setup is the same across all platforms. Just install Node.js and NPM via Homebrew (macOS) or apt/yum (Linux).
Q7: Can I use the same Laravel project on Windows, macOS, and Linux?
Absolutely. Laravel is cross-platform. You can move a project from Windows to macOS/Linux (or vice versa). Just make sure to run:
and update your .env file with the correct database settings for that system.
Conclusion
So in this guide you learned how to:
-
Install Laravel on Windows using Composer.
-
Create and run Laravel projects.
-
Check Laravel version in multiple ways.
-
Run old Laravel projects with migrations.
- How to install Laravel in Linux and macOS.
This is your foundation. From here, next step is exploring the Laravel project structure, where you’ll see how controllers, models, and routes all connect to actually build powerful apps.
