Starting your first Laravel project


Laravel is a great PHP framework and super easy to get setup on your device

21 Feb, 2021 · 2 min read

Today I’ll be showing you how easy it is to get started with a Laravel project.

Laravel is a PHP framework. For me, it focuses on good practices and clean code.

The super cool part about Laravel 8.0 is that it now comes with a simple terminal command to build an app that runs in Docker!

Before we start, make sure you have Docker desktop installed.

Download Docker desktop

Installing Laravel

Once you have Docker installed and setup, we can open the terminal and execute the following command.

curl -s | bash

Running this command will create a laravel-app folder in the current folder you in.

You can change the name to whatever you need it to be, so your projects need to be called client-website run the following command.

curl -s | bash

With this command, it will setup all the packages and even set your application key for you.

To run the application, we can simply cd into the directory and run the following command.

cd laravel-app
./vendor/bin/sail up

The first time the sail up command will take quite a while but don’t worry any time after that, it will be quick.

Note: If you’re on the new Mac M1, you need to change the docker-compose.yml file. Change image: 'mysql:8.0' to image: mariadb:10.5.8

Once everything is installed, you should see the following in your Docker desktop app.

Screenshot 2021-02-16 at 08.21.49.png

And we should be able to view the application going to http://localhost.

Note: you might have to change the port if you already have a server running on port 80

Laravel app running via Docker

And we even get a default Mailhog installation on port 8025:

Screenshot 2021-02-16 at 08.21.34.png

Thank you for reading, and let’s connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on Facebook or Twitter

Spread the knowledge with fellow developers on Twitter
Tweet this tip
Powered by Webmentions - Learn more

Read next 📖

Easy way to create API documentation in Laravel with Scribe

7 Apr, 2021 · 3 min read

Easy way to create API documentation in Laravel with Scribe

Protecting our Laravel API with Sanctum

6 Apr, 2021 · 4 min read

Protecting our Laravel API with Sanctum

Join 2099 devs and subscribe to my newsletter