Include Bootstrap in Laravel

Stefan Izdrail

Founder & Senior Architect · 2026-06-29

Laravel Company
Title: Include Bootstrap in Laravel Effortlessly: A Comprehensive Guide for Newbies Body:

As a Laravel newbie, you probably have already discovered the benefits of using pre-built packages like Twitter Bootstrap to enhance your application's appearance and functionality. Integrating Bootstrap into your Laravel project can seem daunting, especially if you need to modify each package individually. The good news is that there are several efficient ways to incorporate Bootstrap in your Laravel app without compromising on clean code or spending too much time. In this post, we'll discuss the various approaches and guide you through a step-by-step process.

Approach 1: Using Composer

Composer is an effective tool for managing your Laravel dependencies. You can easily install Bootstrap using Composer by following these steps:

  1. Open your project's terminal and run the command 'composer require twb/bootstrap:4.x'. This will install Bootstrap version 4.x in your project.
  2. Create a new file, named 'app.css', inside the 'resources/views/vendor/twb/bootstrap' folder within your Laravel project. Copy and paste the following lines of code into this file:
<!DOCTYPE html>
<html lang="en">
  <head>
    ...
  </head>
  <body class="bootstrap">
    ...
  </body>
</html>

This file will be responsible for loading the Bootstrap framework. You should call this file in your app's layout.

  1. In your Laravel application, update your 'layout/app.blade.php' file with the following code:
@include('vendor.twb.bootstrap::css.app')
...
Remainder of the layout file content

This will ensure that your app uses Bootstrap and loads the necessary CSS files.

Approach 2: Using SASS/SCSS

If you prefer using SASS or SCSS for styling, Laravel offers a convenient way to integrate Bootstrap. Firstly, use Composer as described above to install the Bootstrap framework and create an 'app.css' file inside the appropriate folder. After that, modify your 'layout/app.blade.php' to include the following code:

@extend('vendor.twb.bootstrap::layouts.master')
...
Remainder of the layout file content

This will ensure that Laravel will use your customized 'master' layout containing Bootstrap styling.

Conclusion

Both approaches are effective in integrating Bootstrap into your Laravel project. They offer different solutions based on your preference of working with Composer or SASS/SCSS. Regardless of the approach you choose, ensure that you keep your code clean and well-organized to maintain a smoothly functioning application.

Laravel Company is dedicated to providing comprehensive technical support for Laravel projects. Our experts can guide you through the process of incorporating Bootstrap into your app or help you in other Laravel-related tasks. Don't hesitate to reach out if you need assistance.