In this tutorial, I will show you how to create a Bootstrap 5 Auth Scaffolding in Laravel 9. Auth Scaffolding automatically creates a user registration, login, dashboard, logout, reset password and email verification with the help of Laravel UI package.
Without further delay, lets start building Laravel 9 Boostrap 5 Auth Scaffolding.
Steps to Create Laravel 9 Bootstrap 5 Auth Scaffolding
Follow the below simple steps to create Bootstrap Auth Scaffolding in Laravel 9.
- Install Laravel 9 App
- Install Laravel UI Package
- Install Bootstrap 5 Auth Scaffolding
- Install and Run NPM Packages
- Configuration Database Credentials
- Migrate Tables to Database
- Run Laravel Development Server
1. Install Laravel 9 App
Open the terminal or command prompt and navigate to your desired directory where you want to install Laravel 9 application. I preferred workspace directory on my Desktop.
Now install the latest Laravel 9 version with name Laravel9Auth using the below command.
composer create-project --prefer-dist laravel/laravel Laravel9Auth
2. Install Laravel UI Package
In second step, first I will change the directory to the Laravel9Auth location
and then install Laravel UI package before creating Auth Scaffolding using the below command.
composer require laravel/ui
3. Install Bootstrap 5 Auth Scaffolding
Now in this step, I will install Boostrap 5 Auth Scaffolding by running the below command.
php artisan ui bootstrap --auth
4. Install and Run NPM Packages
I have successfully created auth scaffolding, so lets install NPM and Run NPM, run the below commands.
Make sure that you have installed Node.js in your machine otherwise you will not be able to run npm commands. If you do not have it, visit Node.js official website, download and install it.
It will take some time to install node modules completely on your Laravel 9 application, once node modules are installed, then run the NPM Dev using the below command.
npm run dev
If it ask you to run twice the npm run dev, then follow the instruction and run again npm run dev
And if you are using MAC or Linux, you can run both together like below.
npm install && npm run dev
Once the Laravel mix is compiled successfully, you will get the following message on your terminal or command prompt.
5. Configuration Database Credentials
The most important step is that configure your database credentials on your Laravel 9 app. Go to your application root directory, find .env file and enter your database credentials like below.
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=your_db_name DB_USERNAME=your_db_username DB_PASSWORD=your_db_password
Make sure that your machine already have MySQL or MariaDB installed along with PHP. If you do not have MySQL/MariaDB then you can install it through XAMPP.
I have created a separate tutorial to install XAMPP which comes with PHP, MariaDB and Apache, follow the steps to install XAMPP on Windows 10/11.
Now we have MariaDB installed, make sure your database is running before you execute database migration command.
6. Migrate Tables to Database
Now, it is the time to migrate Laravel 9 all default tables into your database by running the below command.
php artisan migrate
7. Run Laravel Development Server
Now you have successfully completed all the required steps to create Laravel 9 Bootstrap 5 Auth Scaffolding. It is time to start the development server to test the application by using the below command.
php artisan serve
Screenshots of the Laravel 9 Application.
Forgot Password Page
Facebook Official Page: All PHP Tricks