Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Bootstrap Laravel Package

twbs/bootstrap

Bootstrap is a popular open-source front-end toolkit for building responsive, mobile-first websites. It provides ready-to-use CSS and JS components, a flexible grid system, and utilities to quickly create consistent, accessible UI across browsers.

Deep Wiki
Context7

Getting Started

Start by installing Bootstrap via Composer (composer require twbs/bootstrap) to get the official distribution. Unlike earlier versions (v4/v5), the v5 package includes compiled CSS/JS and source SCSS/CSS. In Laravel, publish the config and assets using php artisan vendor:publish --tag=bootstrap (if a service provider is provided) or manually link assets in your resources/css/app.css (e.g., @import 'bootstrap';). Compile with Vite or Mix. First use case: enable responsive layouts by adding the Bootstrap container and grid classes to a Blade template (e.g., <div class="container">...</div>).

Implementation Patterns

  • Component-driven templating: Use Bootstrap’s prebuilt components (modals, navbars, alerts) directly in Blade views—paste HTML/CSS from the official docs.
  • Theme customization: Override Bootstrap variables in resources/sass/_variables.scss (for v5) before importing Bootstrap SCSS to customize colors, spacing, and fonts consistently.
  • JS enhancements: In resources/js/app.js, import Bootstrap’s JS modules individually (e.g., import { Modal } from 'bootstrap';) to avoid bundling unused code.
  • Integration with Livewire/Alpine: Bind Bootstrap modals/toasts via Alpine’s x-data or Livewire events—e.g., emit bootstrap.modal.show from Livewire to trigger new Modal(...).show().

Gotchas and Tips

  • SCSS import order matters: Always define custom variables before @import 'bootstrap'; in SCSS to override defaults.
  • Popper dependency: Bootstrap 5+ bundles Popper internally—do not separately install @popperjs/core unless using custom builds.
  • Minified vs. source files: Prefer the dist/ files for production (bootstrap.min.css/js), but use src/ SCSS for Tailwind-style customization workflows.
  • CSP & nonce compatibility: If using Content Security Policy, Bootstrap’s JS uses eval() in some fallback paths—use the non-eval builds or ensure 'unsafe-eval' is not enforced strictly.
  • Version drift warning: twbs/bootstrap v5+ removed jQuery dependency—ensure legacy Blade components aren’t relying on jQuery plugins like $.fn.modal.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport