Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Owaiz_Yusufi's avatar

How to install Bootstrap in Laravel 9 with vite? The right way.

Seems pretty obvious question but, there is no accurate answer .

The articles and videos that I have seen are using laravel/ui

https://techvblogs.com/blog/how-to-install-bootstrap-5-in-laravel-9-with-vite

https://www.youtube.com/watch?v=E2SiHyK3dO4

https://dev.to/tanzimibthesam/install-boostrap-in-laravel-9-with-vite-5aj2

How can I install bootstrap without using laravel/ui ? Is this possible?

0 likes
6 replies
MohamedTammam's avatar

It has nothing to do with Laravel

You can use CDN

  <head>
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">
  </head>
  <body>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3" crossorigin="anonymous"></script>
  </body>

If you want to customize it for serve it from your server, follow the following: https://getbootstrap.com/docs/5.2/getting-started/vite/

bobbybouwmann's avatar

@MohamedTammam That is not the question, right? He wants to use Vite to have it compile locally and optimize the output for production. The CDN won't do that for you.

MohamedTammam's avatar

@bobbybouwmann I think he just wants to install it anyway. And since Laravel using Vite so he mentioned that. I added that in that case.

ZohaibAhmed's avatar

Bootstrap is a framework of CSS means its used for design in frontend you can use bootstrap classes plus links its not used for backend

Please or to participate in this conversation.