0% found this document useful (0 votes)
152 views11 pages

Mastering Backend Ebook (5) - Compressed

Laravel Breeze is a package that provides authentication functionality for Laravel projects through Tailwind CSS templates. It includes features for login, registration, password reset, email verification, and password confirmation. The document discusses installing Breeze and explains the flow of each authentication process by detailing the involved controllers, routes, and views. It concludes by recommending further Laravel learning.

Uploaded by

henrydiaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
152 views11 pages

Mastering Backend Ebook (5) - Compressed

Laravel Breeze is a package that provides authentication functionality for Laravel projects through Tailwind CSS templates. It includes features for login, registration, password reset, email verification, and password confirmation. The document discusses installing Breeze and explains the flow of each authentication process by detailing the involved controllers, routes, and views. It concludes by recommending further Laravel learning.

Uploaded by

henrydiaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Laravel

Breeze
Tutorial: The
Definitive
Guide (2023)
by Solomon Eseme
Laravel Breeze Tutorial: The Definitive Guide (2022)

Table of Contents
Intro & What is Laravel Breeze....... ................................................3

Overview of Laravel Authentication features................................4

Laravel Breeze Installation..... .........................................................5

Explaining the Login Flow.................................................................6

Explaining the Registration Flow......................................................7

Explaining Password Reset Flow.....................................................8

Explaining Email Verification Flow...................................................9

Explaining Password Confirmation Flow........................................10

Conclusion.........................................................................................11

02
Laravel Breeze Tutorial: The Definitive Guide (2022)

Intro
Laravel 8 brought in many improvements to Laravel and many
more packages such as Laravel Breeze to learn and master.

One of the most notable packages is the Laravel Breeze, a


beautifully designed application start kit for Laravel 8, and it
comes with the implementation of authentication and
authorization.

If you’ve used Laravel Jetstream before, you will notice that it


is a little overwhelming and has a stiff learning curve.

Hence, Laravel Breeze was developed to get you set up quickly


and simpler.

In this article, we will explore everything you need to master


Laravel Breeze.

We will look at the installation guide and discuss the different


authentication processes generated with Laravel Breeze.

In the end, you will be comfortable using Laravel Breeze.

What is Laravel Breeze?

Laravel Breeze is the new Laravel Auth scaffolding that comes


with even more features and simplicity. It comes inbuilt with all
the Laravel authentication features plus our beloved Tailwind
CSS styling and styled blade templates.

03
Laravel Breeze Tutorial: The Definitive Guide (2022)

Overview of Laravel Authentication


features
Laravel breeze creates all the controllers, routes, and views
needed to set up and configure authentication features such as
login, registration, forgot password, reset password, email
verification, and password confirmation.

One of the differences between Laravel Breeze and others is


Tailwind CSS’s introduction right from the box.

Also, Laravel has introduced many application starter kits,


confusing to know which one is used for what.

Let us explore a little of each of them:

Laravel JetStream
Laravel JetStream is a more robust application scaffolding with
more features and additional frontend technology stacks.

It is a complete application and authentication scaffolding with


added features such as two-factor authentication, session
management, optional team management, including all the
Laravel breeze features.

It is also designed with Tailwind CSS, and you can either


choose inertia or livewire for the frontend scaffolding.

You can learn more about Laravel Jetstream here.

04
Laravel Breeze Tutorial: The Definitive Guide (2022)

Laravel Sanctum
Laravel Sanctum is an authentication scaffolding for single-
page applications (SPAs) and APIs.

It solves two distinct problems: managing API tokens by issuing


tokens to users using OAuth and SPAs by Laravel’s built-in
cookie-based session authentication services to authenticate
SPAs.

You can read more about Laravel Sanctum here.

Next, we will explore Laravel Breeze and how the


authentication process really works:

Laravel Breeze Installation


To install Laravel Breeze, you need to have installed and
configured Laravel.

You can read through the Laravel Tutorial: The ultimate guide.

If you already have Laravel installed, let’s run the following


scripts to install and set up Laravel Breeze.

05
Laravel Breeze Tutorial: The Definitive Guide (2022)

Explaining the Login Flow


The login flow from Laravel Breeze is quite an easy one with
modernity and a clean code principle applied to it.

Let’s work through how the login flow is built:

First, go to resources/views/auth/login.blade.com to see the


content of the login form developed and styled with Tailwind
CSS, you can, of course, customize it to fit your design.

When the submit button is clicked, the request is sent from the
new routes/auth.php file /login route down to the store method
of the new AuthenticatedSessionController.php file in the ../
Controllers/Auth folder.

If you look at the store method, a lot has changed, but the main
login and validation logic is found under the $request-
>authenticate() method, which is located under app/Http/
Requests/Auth/LoginRequest.php

06
Laravel Breeze Tutorial: The Definitive Guide (2022)

You can study the codebase very well, but it just validates the
user and attempts to authenticate a user.

Explaining the Registration Flow

The registration flow and logic are quite simple and


straightforward to understand.

First, go to resources/views/auth/register.blade.com to see the


registration form content developed and styled with Tailwind
CSS, you can customize it or add more input fields to fit your
design.

When the submit button is clicked, the request is sent from the
new routes/auth.php file /register route down to the store
method of the new RegisteredUserController.php file in the ../
Controllers/Auth folder.

The store method validate the user inputs and create a new
user based on the information provided.

You can customize the code to accommodate your custom


input fields.

07
Laravel Breeze Tutorial: The Definitive Guide (2022)

The store method validate the user inputs and create a new
user based on the information provided.

You can customize the code to accommodate your custom


input fields.

You can customize the code to accommodate your custom input fields.

Explaining Password Reset Flow

The password reset logic is the same as before, but the few
difference is that the password reset email is sent from ../
Controllers/Auth/PasswordResetLinkController.php under the store
method.

08
Laravel Breeze Tutorial: The Definitive Guide (2022)

Next, when the user clicks the link from their email, Laravel
shows a form to fill in the new password, on submitting, the
request is sent to store method under
NewPasswordController.php where it is handled.

You can take a glance at how Laravel handles the logic.

Explaining Email Verification Flow


Handling Email verification with Laravel breeze is very elegant;
once Send or Resend email verification button is clicked,
Laravel calls the store method in
EmailVerificationNotificationController.php to send out the
verification link.

When the link is clicked, Laravel sends the request to


VerifyEmailController.php and calls the __invoke magic method to
perform the verification.

09
Laravel Breeze Tutorial: The Definitive Guide (2022)

Explaining Password Confirmation Flow

Laravel Breeze introduces a new authentication feature called


Password Confirmation.

With this new feature, you can allow users to confirm their
password before performing that dangerous actions like
deleting their account, withdrawal from a wallet, etc. Let’s
explore the logic flow:

A confirm password form is created under resources/views/auth/


confirm-password.blade.php asking for your password input.

The request is sent to the store method under ../Controllers/


Auth/ConfirmablePasswordController.php where the logic is
written.

There you have it, a walk-through of Laravel Breeze, the newly


created controllers, routes, and views, and where to find any
logic during the authentication process.

Conclusion
So far, we have explored Laravel Breeze and explained the
different authentication flows and where to find the different
logics.

The newly introduced authentication feature is an essential


feature to protect a secured area or restricted actions.

10
Laravel Breeze Tutorial: The Definitive Guide (2022)

What’s Next

Congratulations! By completing the reading of this guide on


Laravel Breeze, you’ve taken the first step toward transforming
yourself into an efficient Laravel Developer. Give yourself a pat
on the back.

Hopefully this guide helped you gain valuable knowledge and


create tangible resources that will help your kick start your
Laravel Development with Laravel Breeze. If you want to learn
the Laravel framework more in-depth. Check out the Laravel
Content Hub.

The next step is to continue build projects with Laravel and


stay consistent in your journey. Laravel is a very broad
ecosystem and requires consistent learning and study to
master. Keep up learning and improving.

One last thing: Let’s transform the way new and old backend
engineers learn Backend Engineering together. Remember to
tweet me (@Kaperskyguru) and MasteringBackend
(@Master_backend) -- we’d love to hear from you and see what
you’ve learnt from this guide. Plus, we’re always looking for
best-in-class work to showcase in MasteringBackend training
materials.

Always be learning,

Solomon Eseme | MasteringBackend

11

You might also like