How to Install Laravel Framework 12.x on Windows

How to Install Laravel Framework 12.x on Windows

Introduction

Thinking about building your next web app with Laravel? You’re in the right place! In this easy, step-by-step tutorial, I’ll walk you through how to install Laravel Framework 12.x on Windows without any stress. Laravel is one of the most loved PHP frameworks out there — and for good reason. It’s clean, fast, packed with features, and backed by a huge community of developers who actually enjoy using it.

Whether you’re brand new to Laravel or switching over from another PHP framework, this guide will help you get everything up and running in no time. We’ll start with the basics — installing WAMP and Composer — then move on to creating your Laravel project, running it locally, and even setting up a custom virtual host. That way, instead of visiting http://localhost/project-name, you can use a sleek URL like http://project-name for a more professional dev setup.

Let’s dive in and get your Laravel development environment ready to roll on Windows!

Setting Up WAMP for Laravel

To install Laravel Framework 12.x on Windows, start by downloading the latest version of WampServer from the official website and installing it on your system. Once installed, verify that both Apache and MySQL services are running correctly by accessing http://localhost and http://localhost/phpmyadmin in your browser.

Note: Default phpmyadmin username is root and password is blank.

Verifying PHP Requirements for Laravel

Before moving forward, it’s important to make sure that PHP is properly installed on your system and that the command line recognizes it. Laravel 12.x requires PHP version 8.2 or higher, so let’s double-check that everything is good to go.

To do this, open your Command Prompt (CMD) and type the following command:

php -v

Note: If you run into this error, just set the PHP path in your environment variables using the screenshot below. Then give it another try.

Installing Composer

To install Laravel Framework 12.x on Windows successfully, you’ll need Composer. Download and install Composer, then open the Command Prompt (CMD) and run the following command to verify the installation:

composer

If you run into this error, try setting the path in your environment variables just like we did earlier with PHP. Then, run the command again.

Installing Node.js

Download and install Node.js, then open the Command Prompt (CMD) and run the following command to check if it’s installed correctly.

node -v
npm -v
node

If you run into this error, try setting the path in your environment variables just like we did earlier with PHP. Then, run the command again.

How to Install Laravel Framework 12.x on Windows

You can learn how to install it from the official Laravel website, or simply follow the step-by-step guide below.

Assume you’re running WampServer on port 80, with your project located in D:\www, and the project folder is named “laravel12x”.

Open the Command Prompt (CMD), navigate to your project root directory, and run the following command:

composer global require laravel/installer
laravel new laravel12x

Update this file D:\WWW\laravel12x\app\Providers\AppServiceProvider.php follow the screenshot below to avoid database migration issues.

Open the Command Prompt (CMD), navigate to your project root directory, and run the following command:

php artisan migrate

Creating a Virtual Host in WAMP

Ensure the WAMP server is running, then open your browser and navigate to http://localhost.

After creating the virtual host, open the .env file and update the APP_URL value to match the virtual host name you just configured.

Since this version of Laravel doesn’t include Vite by default, and we’re using it to manage our CSS and JavaScript assets, we need to install it manually by running the following command:

npm install vite

Once Vite is installed, you can start the development server with:

npm run dev

This will compile your assets and launch the project in development mode.

Next, restart the WAMP server, then open your browser and go to http://laravel12x.

Installation Complete

Congratulations! You’ve now learned how to install Laravel Framework 12.x on Windows from start to finish. You’re now ready to start building powerful web applications with one of the most popular PHP frameworks.

👉 New to Laravel? Check out our beginner-friendly guide: Getting Started with Laravel: Simple Tips for Beginners. It covers everything from installing Laravel 12.x on Windows and configuring your .env file, to understanding MVC, setting up routes, controllers, views, and using Eloquent ORM.

🛠️ Ready to build something? Follow our step-by-step tutorial on Creating Your First Laravel CRUD Application to put your knowledge into practice.

If you found this tutorial helpful, feel free to leave a comment, share it with others, or check out our upcoming guides for more Laravel tips.

Happy coding! 🚀

Leave a Reply

Your email address will not be published. Required fields are marked *