To set up Laravel on Windows, follow these steps:
Step 1: Install PHP
- Download the latest version of PHP for Windows from the official website (https://windows.php.net/download/).
- Choose the appropriate package based on your system architecture (x86 or x64).
- Extract the downloaded files to a directory (e.g., C:\php).
- Rename the file `php.ini-development` to `php.ini`.
- Edit `php.ini` and make sure to uncomment the following extensions:
- `extension_dir = "ext"`
- `extension=curl`
- `extension=fileinfo`
- `extension=gd2`
- `extension=gettext`
- `extension=mbstring`
- `extension=openssl`
- `extension=pdo_mysql`
- `extension=sockets`
- Add the PHP installation directory (e.g., C:\php) to the system's PATH environment variable.
Step 2: Install Composer
- Download and run the Composer Windows Installer from the official website (https://getcomposer.org/download/).
- Follow the installation instructions, and make sure to select the "Install command-line tool globally" option.
Step 3: Install Laravel Installer
- Open a command prompt or PowerShell window.
- Run the following command to install the Laravel installer globally:
composer global require laravel/installer
Step 4: Create a new Laravel project
- Navigate to the directory where you want to create your Laravel project using the command prompt or PowerShell.
- Run the following command to create a new Laravel project:
laravel new project-name
Replace "project-name" with the desired name for your project.
Step 5: Start the Laravel development server
- Change to the project directory by running:
cd project-name
- Start the Laravel development server by running the following command:
php artisan serve
Congratulations! You have set up Laravel on Windows and created a new Laravel project. You can now access your Laravel application by visiting http://localhost:8000 in your web browser.