Weave 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 Bundle Laravel Package

sameddin/bootstrap-bundle

Bootstrap Bundle integrates Bootstrap into PHP applications, bundling frontend assets and offering convenient helpers for building responsive, styled interfaces. It reduces setup work so you can focus on features instead of wiring CSS and JavaScript.

View on GitHub
Deep Wiki
Context7

Getting Started

Install the bundle with Composer (this is a Symfony bundle, not a Laravel package — see Gotchas):

composer require sameddin/bootstrap-bundle

Register it in config/bundles.php (or AppKernel.php on Symfony 2/3):

// config/bundles.php
return [
    // ...
    Elnur\BootstrapBundle\ElnurBootstrapBundle::class => ['all' => true],
];

Enable the Twig form theme in config/packages/twig.yaml:

twig:
    form_themes:
        - '@ElnurBootstrap/Form/bootstrap_3_layout.html.twig'

First use case: render any existing Symfony form and get Bootstrap 3 form-group / control-label / form-control markup without touching the form type:

{{ form_start(form, {attr: {class: 'form-horizontal'}}) }}
    {{ form_row(form.email) }}
    {{ form_row(form.password) }}
    <button class="btn btn-primary">Save</button>
{{ form_end(form) }}

Look first at the bundle's Resources/views/Form/ directory — the twig layouts there define every widget and are the source of truth for what HTML you'll get.

Implementation Patterns

Global theme. Setting form_themes in Twig config applies the Bootstrap markup to every form. This is the normal path for an app that is Bootstrap-3 end to end.

Per-form override. For a single screen, use the form_theme tag at the top of the template, which wins over the global theme:

{% form_theme form '@ElnurBootstrap/Form/bootstrap_3_horizontal_layout.html.twig' %}

Form type extensions for layout props. The bundle ships type extensions that let you pass Bootstrap-specific options straight into form_row/add():

$builder->add('search', SearchType::class, [
    'input_group' => [
        'prepend' => ['icon' => 'search'],
        'append'  => ['button' => 'Go'],
    ],
]);

Static controls and inline checkboxes. Use the bundled types (StaticControlType, ChoiceType with inline) rather than hand-writing <p class="form-control-static">.

Custom widgets. Compose buttons/button groups with the bundle's ButtonType/ButtonGroupType so classes stay consistent across forms.

Workflow tip. Because it plugs into Symfony's form rendering pipeline, the fastest integration is: install → set the global theme → render an existing form → fix only the fields that need extra layout options. Don't rewrite templates wholesale.

Gotchas and Tips

  • Not a Laravel package. Despite the "Laravel developer" framing, this targets Symfony's Form/Twig stack. It will not work with Blade; there is no service provider or facade. If you actually need Bootstrap form markup in Laravel, use your own Blade components or a package like laravelcollective/html-style helpers.
  • Bootstrap 3 only. Class names (form-group, col-sm-*, input-lg, form-control-static, btn-default) do not survive a jump to Bootstrap 4/5. Expect breakage if you upgrade your CSS.
  • Age / abandoned status. With 10 stars, zero dependents, and Symfony 2/3-era code, expect incompatibility with Symfony 5/6/7 (deprecated Form events, choices_as_values, old Twig APIs). Pin the Symfony version or vendor a fork.
  • Theme ordering matters. form_themes entries are tried in order; your global theme must come before any custom theme that extends it, otherwise widgets fall back to Symfony's default form_div_layout.
  • Debugging markup. When a field renders plain HTML, check that form_theme is actually applied — use bin/console debug:twig to confirm the bundle's template path is registered, and inspect the resolved theme with a dump(form) / Twig dump() on form.vars.
  • Custom widgets not available. If you call form_row with an option the theme doesn't handle (e.g., a newer help option), it may silently render nothing. Grep the layout template for the block name before relying on it.
  • Extension points. Override individual blocks by defining your own theme that extends bootstrap_3_layout.html.twig and {% use %}-ing it, then redefining e.g. {% block form_row %}. That's the safe way to customize without editing vendor files.
  • Config quirks. Some options must be set on the form type, not via attr; passing 'attr' => ['class' => 'form-control'] will be merged with — not replace — the theme's classes, so duplicate classes can appear.
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.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo