Getting Started — Installing Laravel 5.7 on Windows

Getting Started — Installing Laravel 5.7 on Windows

Quick Update

So you may have been wondering where on earth have I gone and why there haven't been any updates of my Laravel journey, well I’ll keep this short and sweet, I broke my little finger & torn the ligament in it, so you can imagine I had one floppy finger. I also became a proud father just over 3 months ago and life has just been a rollercoaster — now I have some time off work so I thought I’d best get back to this journey.

Image created on Canva

To begin installing Laravel on Windows you need to decide which of these tools you will be using on Windows OS to spin up a development environment. You have the choice of using the following but not restricted to;

I’ll be using XAAMP as I have this already installed on my computer. I won’t guide you on how to install XAAMP as there are loads of tutorials out there that will show you how to get that done.

Before installing Laravel, you need to install Composer. You can either install it locally or globally. Locally means inside the project folder and globally means system-wide — so it’s accessible outside of the project folder.

Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

As we are using a Windows OS we need to download composer using this link. This will ensure that Composer will install the latest version. We always want the most up to date version of Composer.

To quickly install Composer in the projects directory you need to run the following command in your terminal. You can use GitBash or the built-in terminal in Visual Code.

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"  
php -r "if (hash\_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP\_EOL;"  
php composer-setup.php  
php -r "unlink('composer-setup.php');"

It’s really important that we install Composer globally, you only have to do this once, after all, we don’t want to be repeating ourselves for every new project we spin up. DRY!

You can find out how to do this by checking the official documentation on the Composer website here.

Installing Laravel via Composer

Fingers crossed that installing Composer has gone to plan if you’ve struggled, I’d recommend watching a few videos on YouTube on getting started with Composer.

Run this command in your terminal;

composer global require laravel/installer

Make sure to place composer’s system-wide vendor bin directory in your $PATH so the laravel executable can be located by your system. This directory exists in different locations based on your operating system; however, some common locations include:

macOS: $HOME/.composer/vendor/bin

GNU / Linux Distributions: $HOME/.config/composer/vendor/bin

Once that has finished installing, the laravel new command will be available to use. The next command you need to run is;

laravel new <this can be named anything>

After the keyword, “new” give the laravel installation a suitable name. For example, if you are going to create a blog, then I’d call it a blog.

Here is a short video on how to install Laravel;

Local Development Server

If you have PHP installed locally and you would like to use PHP’s built-in development server to serve your application, you may use the serve Artisan command. This command will start a development server at [http://localhost:8000](http://localhost:8000:):

You should now be fully set up and be able to access the laravel installing on the localhost URL. I’ve kept this quite brief and not gone into greater detail on how to install Laravel & Composer as there are loads of video guides out there available to you.

I hope you’ve enjoyed this post if you have, give it a clap and share. It’ll be highly appreciated. And if you want to join me on the Laravel journey, drop me a comment in the comments section & I’ll get back to you. Thanks.