← Other topics

Laravel In a Nutshell - Intro & Installation (#1)

Series contents:

Video Notes

Laravel is an awesome tool for building web applications, but it can be overwhelming for beginners with its abundance of features and complex infrastructure.

Because of this, my goal with this series is to give you a broad overview of working with Laravel. My hope is that you will walk away from this series with a concise overall picture of Laravel, prepared to rewind and dig deeper into each individual feature.

Knowing that, let’s get into this videos topic...

Setting up a development environment

To get started building a Laravel application, you need a development environment. Most commonly, you’ll run this environment locally on your computer so you can work out all the kinks of your application before releasing it to the public. When your application gets to the stage where you’re ready to “go live”, you’ll deploy it to a production server where the rest of the world can access it.

Later in this series I’ll talk about that deployment process, but right now we’re just focussed on the local, development environment.

Here are the components you need to set up a development environment:

  • A web server (either Nginx or Apache)
  • PHP with these extensions
  • Composer - a command line based dependency management program for PHP

The easiest way to get these components set up is using a program like Herd ( Mac) or Laragon ( Windows) which come bundled with everything you need to run Laravel.

This guide will cover both Herd and Laragon. If you’re following along in the video, the instructions for Mac/Herd starts at 1:49 and the instructions for Windows/Laragon start at 5:26.

Mac - Herd

Download Herd from https://herd.laravel.com and install it on your computer.

With Herd running, find your settings from the H icon in your menu bar. Within the General tab, you’ll see a list of paths where Herd will look for new sites:

Herd paths under the General tab

In order for Herd to set up a new site, it just needs to exist in one of the directories listed here. For my example, I’ll create a new site in the directory /Users/Susan/Herd.

To navigate to that directory, I’ll load Terminal and run the following command (where ~/ is an alias for my home directory, /Users/Susan):

> cd ~/Herd

Within this directory, we’ll use Composer to initiate a new Laravel application. Replace demo in the following command with the name of your application:

> composer create-project laravel/laravel demo

After the application has been created, return to your Herd settings and find the Sites tab. Herd should automatically detect your new application and generate a URL following the pattern of http://directoryname.test.

Herd detects and sets up URLs for any Laravel applications detected in your watched paths

Load the new URL in your browser and you should see the default welcome screen of your new Laravel application:

New Laravel application running on Herd

Windows - Laragon

Download Laragon from https://laragon.org and install it on your computer.

Once installed, click Start Servers to boot up your local server.

Next, load Terminal and change into Laragon’s default document root where we’ll generate a new Laravel application.

> cd C:\laragon\www

Within this directory, use Composer to initiate a new application. Replace demo in the following command with the name of your application:

> composer create-project laravel/laravel demo

After the application has been created, stop and restart the Laragon servers. Laragon should automatically detect your new application and generate a URL following the pattern of http://directoryname.test.

Load the new URL in your browser and you should see the default welcome screen of your new Laravel application:

Conclusion

That’s it for installation! Next up, let’s learn about routes and start to customize your application: Routes - Laravel In a Nutshell

If this info helped you out you can say thanks and support future content by clicking my Amazon affiliate link: https://amzn.to/3UtgnYk. If you make a purchase on Amazon within 24 hours of clicking the link I may receive a micro-commission and it costs you nothing extra. Any income from these sales goes directly to supporting me in making new videos and guides. Thank you for your support!

← Other topics