Laravel-8 Authentication with Breeze
Requirements:
Php
Composer
Node & Npm
MySql
First of all create a new laravel project, just hit the below command:
composer create-project --prefer-dist laravel/laravel:^8.0 FirstProject# if your composer install globally then you may hit this command
laravel new FirstProject
After the installation completes, then go into the project folder.
cd FirstProject
OPTIONAL: If you are creating new laravel project this will automatically create the .env file then you don’t need this step but if your don’t have the .env file you must perform this step.
Copy the .env.example file to .env and generate the application key:
cp .env.example .env
php artisan key:generate
php artisan optimize:clear
Now we have to add and install the breeze to our project, by using these commands:
composer require laravel/breeze --dev
Installation of breeze by typing below command:
php artisan breeze:install
Now, install the node modules:
npm install
npm run dev
Create a database and set the credentials in the .env file, just like
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=breeze # your database name
DB_USERNAME=admin #your database username
DB_PASSWORD=password #your database password
Now, clear the config but, remember if you are using laravel 8 then you may don't need to run this command but if you wanna hit this command it’s up to you. Nothing will change it just clear the configuration.
php artisan optimize:clear
The final step is to run the migrations:
php artisan migrate
Breeze Authentication is done, check the project is running properly:
php artisan serve
I hope it helps!