How to Install Bootstrap 4 in Laravel 9?

Laravel 9

Nicesnippets

09-05-2022


How to Install Bootstrap 4 in Laravel 9?

Hi Guys,

Today, I will learn you how to install bootstrap 4 in laravel 9, We will show step-by-step install bootstrap 4 in laravel 9. and we will explain laravel 9 install bootstrap 4. you can see install bootstrap 4 in laravel 9. if you have a question about how to use bootstrap in laravel 9 then I will give a simple example with a solution. you'll learn laravel 9 npm install bootstrap 4. you will do the following things for install bootstrap for laravel 9.

If you are a beginner with laravel 9 then I am sure I can help you to install bootstrap 4 in laravel 9. it's a very simple way to install using laravel ui composer package. laravel ui package add laravel 9 support.

Laravel ui provide a way to install bootstrap, vue, and react setup. they also provide auth scaffold for login and register. laravel 9 provide an easy way to work with bootstrap, vue, and react.

Here, I will give you a full install for Bootstrap 4 in laravel 9 as bellow.

If you want to install bootstrap 4 in your laravel 8 project then install the following laravel ui composer package to get the command.

Step 1: Download Laravel


Let us begin the tutorial by installing a new laravel application. if you have already created the project, then skip following step.

composer create-project laravel/laravel example-app

Step 2: Install Laravel ui

composer require laravel/ui

Next, successfully install the above package then I will be ready to install bootstrap 4 with our application.

I can install two ways, one is a simple bootstrap 4 setup install and another is install bootstrap 4 with auth. So let's see both ways.

Step 3: Install Bootstrap 4

php artisan ui bootstrap

Step 4: Install Bootstrap 4 with auth

php artisan ui bootstrap --auth

Here we installed bootstrap, you can see your resource directory js folder.

You also need to install npm and run it. so let's run both commands.

Step 5: Install NPM

npm install

Step 6: Run NPM

npm run dev

Now you can work with your bootstrap 4 in laravel 9 app.

You can use it as like bellow:

<!doctype html>

<html>

<head>

<!-- Scripts -->

<script src="{{ asset('js/app.js') }}" defer></script>

<!-- Styles -->

<link href="{{ asset('css/app.css') }}" rel="stylesheet">

</head>

<body>

<h1>This is example from nicesnippets.com</h1>

</body>

</html>

It will help you...