Easy Laravel 8 Authentication Tutorial using Breeze

By: Suriyal

Laravel 8 Authentication Tutorial using Breeze with with blade and Tailwind CSS (Registration, Login, Log Out, Forget Password)

Laravel provide authentication and application starter kits to quickly & automatically scaffold  application with the routes, controllers, and views. Laravel Breeze is same kit for the implementation of authentication features. Laravel Breeze provide many features like login, registration, password reset, email verification, and password confirmation, etc.

Authentication is the process of identifying the users. During this authentication process users credentials will be checked so that identity of the users can be validated. Once identity of the user is validated the user is authenticated in that particular application.

Table of Contents

    Prerequisite

    We are using window operating system for this demo. We have installed XAMP and composer to create the Laravel applications. If you are using window operating system install XAMP and Composer to create the Laravel applications. I am using visual studio code for this tutorial but you can use any code editor of your choice.

    Install Laravel 8 Application using composer

    To install Laravel and create application:

    1. Open command prompt and go to the following directory

    C:\xampp\htdocs

    2. Type the following command in the command prompt and press enter

    composer create-project --prefer-dist laravel/laravel AuthBreezeTutorial
    Note : you can give any name to this project I am giving AuthBreezeTutorial

    OR

    You can use Laravel Installer. Type the following commands in you command prompt

    1. composer global require laravel/installer
    
    2. laravel new AuthBreezeTutorial

    Create Database

    Open PhpMyAdmin and create one new database with the name ” AuthDatabase “. We will use this database in this tutorial.

    Connect the MySQL Database with the Application

    Open the .env file and enter the your database connection details. I am using the following credentials for demo purpose only.

    DB_CONNECTION=mysql
    DB_HOST=127.0.0.1
    DB_PORT=3306
    DB_DATABASE=AuthDatabase 
    DB_USERNAME=root
    DB_PASSWORD=*********

    Run the Migration

    Open the command prompt and run the following command to run the migration

    php artisan migrate

    The following is the database view with table after the migration. All tables are created by default by the Laravel artisan migrate command.

    Install Laravel Breeze using Composer

    1 . Install Laravel Breeze using the following command

    composer require laravel/breeze --dev

    2 . Now run the following command for scaffolding. This command will publish views, routes, controllers, and other resources to this application.

    php artisan breeze:install

    3. Install npm Packages and compile your assets to make CSS file available. Type the following command

    npm install
    
    npm run dev
    
    OR
    
    Using the following single command
    
    npm install && npm run dev

    Run Development Server

    We are using Apache web server and you can type the following command in the command prompt to test the application on the the server

    php artisan serve

    Open the browser and enter the following url

    http://localhost:8000/

    As you can see in the following screen we have to link button one is for login and one is for Register. These link buttons or the login and registration features are because of Laravel Breeze. Laravel Breeze installed the all authentication features for us. The is easy and very quick wat to get started with authentication.

    Registration screen : As you can see in the following screen we have ready to use registration page. You can enter the details and register. The registration system is working fine without any issues.

    Login Screen : In the following screen just enter the details of the user created using the above registration process and check if you are able to login or not. I am successfully able to login using the credentials created during the registration process.

    Forget password screen

    After successful login you will see the similar screen as following

    Thank you for reading this Laravel Authentication tutorial
    
    Have a great learning experience !

    Leave a Reply

    Your email address will not be published. Required fields are marked *