In this blog, you will learn to complete Laravel authentication with Breeze. Laravel Breeze provides the 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 the 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 a new Laravel application. For creating a new application, open the 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 a fresh application we need to connect it with the database by providing database configuration to .env. To configure database detail like the 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 the project directory then enter the 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 the below command:
php artisan breeze:install
This command will produce output that says Breeze scaffolding installed successfully.
In our application, there are a few migrations that are created automatically by the Laravel framework. like user, failed jobs, personal access tokens, and password reset. So we have to create a database table using those migrations.
php artisan migrate
This command will generate a database table using migrations.
Install Npm Packages and Run Production
Before completion, we have to compile our assets into our project so the application can run flawlessly. That can be achieved by running the node js command :
This command will download and install all necessary files. Then we will need to compile it into a single file, which will improve the performance of our application.
npm run prod //or npm run dev
After completing this process our application is ready to test.
Run and test the application
For running this application we just have to give the following command:
php artisan serve
Now, open the browser and hit the following URL on it: