Getting Started with Laravel

Darrin Deal -

It has never been easier to get started with Laravel. In this blog post I am going to explain what Laravel is, why you should build with it and what you need to learn using the Laravel Framework. It’s not as much as you think!

Getting Started

Before we dive into what you need to download and install to learn Laravel development, let’s answer what is Laravel and why should I use it? Laravel is a PHP framework that gives you the tools to build powerful web applications. What makes it special is the community, the third-party packages, and the ease of use Laravel provides.

The answer to the why should I build with Laravel question is easy to answer. Laravel provides the building blocks to create something great.

Need queues? Laravel has it.

Need database migrations? Laravel has it.

Need a caching layer? Laravel has it.

If you need it as a foundation for your application it is likely Laravel comes out of the box with what you need. I recommend looking at the documentation just to see how many things are provided by just installing Laravel.

What do I need to install to run Laravel?

Over the years what you needed to install to run Laravel has changed. As of Laracon US 2023, a conference around Laravel, a new product was announced to help with this. Herd is a development environment wrapped up in one application for both MacOS and Windows. I recommend downloading Herd to let this be your dev environment. Let’s talk about what Herd includes.

Base Features

Out of the box Herd includes PHP, Node, Composer, and Nginx. These are the building blocks that Laravel apps are built upon. With Herd you are able to install multiple versions of PHP and Node. Why would you need this? Because you can work on multiple apps that require different versions of these tools for each app.

Herd is setup to run sites out of a single directory where each directory inside is a different site. You can access this site in the browser by typing in the directory name and adding .test to the end of url.

Pro Features

Recently, the team behind Herd add a pro license that adds more features such as a mail service, included MySql, included Redis, and more. For what you learn here on the Art of Laravel you will not need these pro features, but it’s a great deal for the serious Laravel developer.

Code Editor

After installing Herd you will need a code editor. This comes down to personal preference. If you are just starting out use something like VS Code. If you are a more advanced developer I recommend getting PHP Storm. This has been a game changer for my development work.

Getting Around Pro Features of Herd

Now if you want to use the Pro features of Laravel Herd but don’t want to pay for it here are some solutions I think are great. The most used services that Laravel Herd provides are MySQL, an SMTP (Mail) server, and Redis. Let’s look at solutions for both.

MySQL and Redis

In the latest version of Laravel the default database driver is SQLite. This is easy to use and will work for most applications. With that said, there are times that you need MySQL for one reason or another. That is where DBngin comes in to play.

DBngin allows you to create MySQL databases easily. With a click of button a new database service can be created! The cool thing is with DBngin you can also create Redis instances as well.

SMTP Service

Fo mail service you can use a tool like MailHog to capture these emails. Another tool that I use is called MailPit. Either one will capture the email, and display it in a test inbox. This has been a live saver when developing notifications

Starting a New Laravel App

After installing Herd you have everything you need to create an awesome app. Open a terminal of choice and point it to your Herd folder where your sites are hosted and run the following command.

laravel new {project_name}

Follow the prompts provided and you will have a new application ready to start developing.

Where to Go From Here?

Now that you have Herd installed you are ready to learn Laravel development. You will find great tutorials here on The Art of Laravel to get you started. To know when these tutorials arrive you should join The Art of Laravel Newsletter by clicking here! Happy developing!

Other articles you might enjoy...