There are a few different ways to get up and running with Laravel. In the past, I have had students install PHP and Composer on their machine. This works reasonably well for simple applications and for most of the topics that we cover in this class. One drawback however is that sometimes students run into issues and it can be challenging to debug since everyone has a different operating system. It also involves a bit more configuration and command line usage, which isn't ideal for those who are newer to the command line. A little over a year ago, Laravel introduced a new tool called Laravel Sail that allows developers to build Laravel applications using Docker.
What is Docker? Docker is a tool that makes it easy to create isolated development environments regardless of what operating system you have. This means that we can all run our Laravel applications on Linux with the same versions of PHP, Composer, MySQL, Postgres, Redis, etc without having to install those technologies directly on our machines. This is really powerful! We don't have to spend hours installing various technologies and configuring them. Instead, we can install Docker and spin up a development environment for Laravel applications with a single command, thanks to both Docker and Laravel Sail. Laravel Sail makes it really simple, so you don't even really need to know Docker. Just having a basic understanding of Docker will suffice.
If you're familiar with virtual machines, think of Docker as a tool that can help us spin up a lightweight virtual machine called a container. Think of a container as an isolated environment with its own file system that runs on top of another operating system. For example, I have a Mac, and I can use Docker to create a container for the different applications I am building. Each of these containers are completely isolated from the others.
Now that you have a basic understanding of Docker, let's set up a Laravel application using Laravel Sail, which uses Docker.
If you have an M1 Mac, please read this paragraph. When Apple introduced their computers that use an Apple chip (also referred to as Apple Silicon or the M1 chip), Docker wasn't supported. I think this has changed and Docker does work on these newer Apple computers. However, I can't verify this because I have an older Mac that uses an Intel chip. If you have a Mac with an M1 chip, please let me know if you have any issues OR if the installation was a smooth process. From what I've researched, I think it should work. The only thing that I think doesn't work are MySQL databases, but we won't be using MySQL in this class. We will instead be working with Postgres databases that will be hosted on AWS via Heroku.
Follow the instructions for your operating system. In the instructions, wherever it says "example-app", replace that with "music-app".
If you run into any issues, here are a few resources you may find helpful: