Login Register with Bootstrap Auth in Laravel

Login and Registration with Laravel are very simple, easy, and quick. You can make it within five minutes. Laravel provides you pre-build functionality for login and registration of new users. You just need to follow the following steps.

Step 1: Install Laravel

Create a new Laravel project using composer, if you do have not any project exists. You can use the following command to create a new Laravel project.

composer create-project --prefer-dist laravel/laravel project-name

Step 2: Create database and configurations

Create a new database with any name and configure it in the .env file. You should add database configurations in .env like the following example.


You need to find and place your database details in the above const .env file.

Step 3: Install Auth package

Now, you need to install the bootstrap UI and auth package using composer. Run the following command step by step.

composer require laravel/ui

php artisan ui bootstrap --auth

npm install && npm run dev

Note: In case you got the npm command not found error then install npm first and then run the above command. For windows, you can install the node LTS package. So, that you can able to run the npm commands.

Step 4: Run Migrations

After the above, you need to run the migration to create a table for the user. You can use the following command to do this.

php artisan migrate

Step 5: Set Routes

After successfully installing the above packages, you need to set routes for auth functionality. So, you just need to set one route for managing auth basic process. Define the routes for login and registration in web.php


Note: If the above route is already set just leave this step. You can customize the views for login and registration by editing the files in the resources/views/auth folder.

Step 6: Run the Project

Now, you serve your project by following the command and are able to see the auth functionality in your project.

php artisan serve

Note: In case you got any CSS issues in your login register route then just need to stop the serve command and re-run the following command.

npm install && npm run dev


Hope this blog is helpful to you. If you have any queries or feedback please comment to me.