How to Read Code: Season 2
It's time for a new entry in our "How to Read Code" series. This season, we'll dive into the Laravel Breeze source code, taking every opportunity to peek behind the scenes to learn how and why it was constructed in this way.
While it's often unnecessary to review the underlying code of the packages and tools you use, that doesn't mean you won't benefit from doing so. If you want to become a better programmer, you must learn, read, and write a lot of code. This series focuses on the reading.
Progress
Series Info
- Episodes
- 8
- Run Time
- 1h 19m
- Difficulty
- Intermediate
- Last Updated
- Mar 2, 2021
- Version
- Laravel Breeze 1
Series Episodes
- Episodes (8)
Before We Start
This season, we'll take a look at a first-party package: Laravel Breeze. For this style of series, we're not as focused on how to use the underlying tool (even though we'll figure that part out in the process). Instead, we're more interested in reviewing how it was constructed and wired up behind the scenes.Inspect the Install Command
In the last episode, we installed Laravel Breeze and prepared to run the initialbreeze:installcommand. But before we do that, let's take a look at how that particular command was prepared.Registration Review
At this point in our learning, we've realized that the Laravel Breeze package is primarily an Artisan command. That's it. It's a command that copies over some existing stubs to your new Laravel project, and then updates yourpackage.jsonfile. This means the core of what Breeze provides is in those stubs. With that in mind, let's begin by reviewing basic registration.Breeze Uses Blade Components
If you're not yet familiar with Blade components, thatregister.blade.phpmay initially seem odd. What are all these HTML-lookingx-application-logoandx-auth-cardtags?Email Verification Research
As we finish up our review of registration, this will give us an opportunity to step outside of Breeze and look at how Laravel handles email verification. As part of this lesson, we'll also install MailHog, which will allow us to easily intercept and review emails that our application sends.You Are Responsible for the Code
After you install Breeze into your application, you are entirely responsible for the code. You can adjust the code how you see fit to suit your current project.Password Confirmation Deep Dive
Let's review the basic flow for requiring password confirmation before loading a particular route. Pay special attention, because in the following episode, we'll rewrite the functionality from scratch.Rewrite the Password Confirmation Functionality
It's important that we don't fall into the trap of reading a lot of code, but rarely writing any of our own. With that in mind, let's take what we learned about password confirmations in the previous episode, and rewrite the functionality from scratch. Think of it like a kata. Once finished, we can throw away the code entirely. The goal is to focus on general workflow and habit building.
