Install Xampp from https://www.apachefriends.org/index.html
- Run the Xampp installer and open the Xampp control panel
- Make sure that you enable the Apache and MySQL services
- On mac you need to click "Start" on the Home tab, "Enable" on the Network tab and "Mount" on the Location Tab. Click "Explore" on the location tab to open your Xampp/Lampp folder
Go to https://getcomposer.org/download
- On Windows, download and run the installer
- On Mac, copy the php commands and run in the terminal. Then copy the mv command and run in terminal. You can also install composer with Homebrew
Open a terminal in the htdocs folder. htdocs is where all of your local projects go.
htdocs folder location:
- Windows - C:\Xampp\htdocs
- Mac - /opt/lampp/htdocs
composer create-project --prefer-dist laravel/laravel PROJECT_NAME
We now need to create a virtual host for our project
- Windows - C:/Windows/System32/drivers/etc/hosts
- Mac - /etc/hosts
Add these lines
127.0.0.1 localhost
127.0.0.1 PROJECT_NAME.test
- Windows - C:/xampp/apache/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/PROJECT_NAME/public"
ServerName PROJECT_NAME.test
</VirtualHost>
- Mac - /opt/lampp/etc/extra/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot /opt/lampp/htdocs
ServerName localhost
ServerAlias www.localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /opt/lampp/htdocs/PROJECT_NAME/public
ServerName PROJECT_NAME.test
ServerAlias www.PROJECT_NAME.test
</VirtualHost>
Now visit http://laravel.test ot htttp://laravel.test:8080 on Mac
- Windows - C:/xampp/apache/conf/httpd.conf
- Mac - /opt/lampp/etc/httpd.conf
Remove the # from the beginning of this line
#Include etc/extra/httpd-vhosts.conf
Save the file
I also struggled with the instructions on this page. I've documented the steps I took, and will paste them below.
This worked for me:
Software to Install
Install Xampp
Install Composer
Configure PHP.ini
Open Xampp and click on the
Config
button to the right of the Apache server. ChoosePHP (php.ini)
to edit the PHP configuration file.Find the line that says
;extension=zip
and remove the;
comment symbol to activate the ZIP extension.Save the
php.ini
file.Setup a New Laravel Project
Open a new Command Prompt (tap Windows key and search for
cmd
).Type
cd \xampp\htdocs
(or another path if you installed Xampp anywhere else)Create a new Laravel Project (
laragigs
in the below example), by typing the following:Create a Virtual Host
To setup a virtual
http://laragigs.test
host for testing purposes, do the following:Open a File Explorer and go to
C:/Windows/System32/drivers/etc
.Open the file called
hosts
in a text editor with Admin Privileges.Add these two lines to the bottom of the
hosts
file:Save the file.
Then go to
C:/xampp/apache/conf/extra
and open the file calledhttpd-vhosts.conf
.Add these lines to the bottom:
Save the document and restart the Apache Server in Xampp.
Then surf to http://laragigs.test and you should see the default Laravel startpage.
Open Laravel Project Folder in Visual Studio Code
Open a Command Prompt if you haven't done so already and
cd
into the\xampp\htdocs\laragigs
folder.Now, type in
code .
to open the current folder in Visual Studio Code.Et voilá!