breeze authentication tutorial in laravel

In this blog, you will learn complete Laravel authentication with Breeze. Laravel Breeze provide required methods for login, register, logout, forget password, profile ,reset password page, email verification and much more.

  • Step 1: Install Laravel App
  • Step 2: Connect Application with Database
  • Step 3: Install breeze Auth Scaffolding
  • Step 4: Database Migrations
  • Step 5: Install Npm Packages and Run Production
  • Step 6: Run and Test

Create Laravel Application ( Skip this step for existing application )

First of all, Let's create new Laravel application. For creating new application, open terminal or command prompt and run this command :

    
        laravel new BreezeExample
        //Or
        composer create-project --prefer-dist laravel/laravel BreezeExample
    

Database Connection With our application

After creating fresh application we need to connect it with database by providing database configuration to .env. To configure database detail like following:

    
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=Your database name
DB_USERNAME=database user name 
DB_PASSWORD=database password
    

Install breeze Auth Scaffolding

In this step, we will install breeze Auth Scaffolding with composer. For that first of all, change to project directory then enter below command.

    
composer require laravel/breeze --dev
    

This command will download all necessary files. after download completion we have to install it to our application with below command:

    
php artisan breeze:install
    

This command will produce output that says Breeze scaffolding installed successfully.

Database Migrations

In our application there are few migrations which is created automatically by Laravel framework. like user, failed jobs, personal access token and password reset. So we have to create database table using those migrations.

    
php artisan migrate
    

This command will generate database table using migrations.

Install Npm Packages and Run Production

Before completion we have to compile our assets into our project so application can run flawlessly. That can be achieved by running node js command :

    
npm install
    

This command will download and install all necessary files. Then we will need to compile into single file, which will improve performance of our application.

    
npm run prod 
//or 
npm run dev
    

After completing this process our application is ready to test.

Run and Test Application

For running this application we just have to give following command:

    
php artisan serve
    

Now, open browser and hit the following URL on it:

    
http://127.0.0.1:8000
    

Share your thoughts

Ask anything about this examples