In this kick-off episode, we're starting a fresh Laravel project from scratch, so you get to see every step involved in setting up a solid foundation for development. We start by creating a new Laravel app called comments
using the Laravel installer, and walk through basic setup like choosing MySQL for our database, running migrations, and opening the project in an editor (use whatever editor you're comfortable with!).
We handle some housekeeping, like removing the default welcome view, setting up Tailwind CSS for styling, and organizing our base app layout using Laravel Blade components. If you're a fan of clean starts, you'll appreciate how we tidy up model configuration (like unguarding models for convenience while building) and set some sensible defaults in our .env
file.
We also bring in a few handy development helpers, like Laravel Debugbar for monitoring performance, and we swap PHPUnit for Pest as our testing framework to keep testing nice and smooth. I show you how to set up Pest, initialize it, and write a basic test to make sure our homepage loads as expected. Along the way, we make sure our test DB is set up to use SQLite in-memory (so we never accidentally wipe our main database!).
To wrap up, we refactor our route setup to use an invokable HomeController, making our routing cleaner and more maintainable, and we update our test accordingly. With a quick check in the browser (and a passing test run to finish), our base project setup is complete and ready for future development.
If you're looking for a repeatable, sensible Laravel project setup—this episode covers all the essential steps to help you hit the ground running!