Laravel 9 Authentication with Laravel Breeze

In this tutorial you will see how to install Authentication with laravel breeze pakage. Laravel Breeze is a minimal, simple implementation of all of Laravel's authentication features, including login, registration, password reset, email verification, and password confirmation. Laravel Breeze's default view layer is made up of simple Blade templates styled with Tailwind CSS.


Laravel 9 Authentication with Laravel Breeze


Step 1: Set Up Laravel Project

Step 2: Set Up Database Details in ENV

Step 3: Install Breeze

Step 4: Step up Auth Scaffolding

Step 5: Run npm install && npm run dev command

Step 6: Migrate your database


Step 1: Set Up Laravel Project

Installing a fresh new laravel 9 application, so head over to the terminal, type the command, and create a new laravel app.

composer create-project laravel/laravel project-name

Step 2: Set Up Database Details in ENV

Now, you have to connect the laravel app to the database, hence open the .env configuration file and add the database credentials as suggested below.


.env

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=database_name
DB_USERNAME=database_user_name
DB_PASSWORD=database_password


Step 3: Install Laravel Breeze

Next, you need install laravel breeze via composer.

composer require laravel/breeze --dev


Step 4: Step up Auth Scaffolding

Chose anyone one for you requirements.

1) for simple authentication to run below command.

php artisan breeze:install


2) Breeze & Inertia

if you want to start your single page application. you can chose laravel breeze with inertia

php artisan breeze:install vue
 
// Or...
 
php artisan breeze:install react
 
npm install
npm run dev
php artisan migrate


3) Breeze & Next.js / API

If you want create seo app then you can go with laravel breeze nextjs api.

php artisan breeze:install api
 
php artisan migrate

You can also read below article setup with laravel breeze api with next.

Laravel Breeze API Install & Setup Authentication with Next.js


Step 5: Run npm install && npm run dev command

you need to install first node npm if you do not have node npm package then install first other wise Laravel mix not working .

npm install && npm run dev


Step 6: Migrate your database

Next,run this command

php artisan migrate

Now our Laravel 9 authentication system is ready. you can run serve 

php artisan serve


For more details or any new change you can read official laravel doc

Tags: