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

snowcap/bootstrap-bundle

Snowcap Bootstrap Bundle integrates Bootstrap with Symfony, providing form themes, Twig helpers, and ready-made UI components so you can build responsive interfaces faster with less custom markup.

View on GitHub
Deep Wiki
Context7

Getting Started

snowcap/bootstrap-bundle is a Symfony 2-era bundle that wires Twitter Bootstrap styling (form themes, layout scaffolding, icon helpers) into a Symfony application. Because it predates Symfony 3/4, expect every step to follow the Symfony 2 conventions (AppKernel, app/config/config.yml, app/Resources/... overrides).

  1. Install it.

    composer require snowcap/bootstrap-bundle "~1.0"
    

    Composer will likely fail if you're on PHP 8 or Symfony ≥ 3; the bundle's composer.json pins to symfony/symfony ^2.x. If you're porting an old app, verify PHP 5.6–7.0 compatibility before anything else.

  2. Register the bundle in app/AppKernel.php:

    new Snowcap\BootstrapBundle\SnowcapBootstrapBundle(),
    

    Typically this also needs its sibling bundles (SnowcapCoreBundle, plus KnpMenuBundle and KnpMenuBundle's Bootstrap integration) loaded first — the bundle's templates and menu renderers assume those dependencies are present.

  3. Look first at Resources/config/ and Resources/views/. These are the source of truth for the bundle's service definitions and Twig overlays. There is no meaningful documentation site; the README.md on the repo is short, so the fastest way to learn the API is to read the bundle's own templates.

  4. The first real use case is form theming. Once enabled, the bundle exposes a Bootstrap form theme you can apply globally from config.yml:

    twig:
        form:
            resources:
                - 'SnowcapBootstrapBundle:Form:fields.html.twig'
    

    Or per-template:

    {% form_theme form 'SnowcapBootstrapBundle:Form:fields.html.twig' %}
    {{ form(form) }}
    

    That single step is usually why someone reaches for this bundle: it replaces Symfony's default <div>-heavy form markup with Bootstrap 3 grid markup.

Implementation Patterns

  • Base layout inheritance. The bundle ships a Bootstrap-ready layout (layout.html.twig under Resources/views/). Most projects copy rather than extend it, because Symfony 2 Twig overrides (app/Resources/SnowcapBootstrapBundle/views/layout.html.twig) are the intended customization path — overriding the vendor template beats subclassing a template that won't be maintained.

  • Form theme layering. Keep your app's form theme as the "outer" resource and the bundle's as the fallback so Bootstrap markup survives while your project-specific widgets win:

    twig:
        form:
            resources:
                - 'AppBundle:Form:fields.html.twig'        # your overrides first
                - 'SnowcapBootstrapBundle:Form:fields.html.twig'
    

    This ordering matters — Symfony resolves the first matching block, so putting the bundle last gives you a stable Bootstrap base with targeted overrides.

  • Menu rendering. The bundle pairs naturally with KnpMenuBundle's Bootstrap renderer. In your layout:

    {{ knp_menu_render('main', {'style': 'navbar'}) }}
    

    and let the bundle's Bootstrap CSS classes handle the markup. If the icons render as empty <i> tags, that's the bundle expecting Font Awesome classes from its own asset include — check the bundle's base template.

  • Asset wiring. It's a Symfony 2 bundle, so assets typically flow through Assetic filters or the bundle's Resources/public/. Run app/console assets:install --symlink (or assetic:dump --env=prod) and reference the bundle's CSS/JS via {{ asset('bundles/snowcapbootstrap/...') }}. Don't copy the bundle's assets by hand — reference them through bundles/... so upgrades don't need manual re-copying.

  • Per-form overrides. For one-off forms, don't touch the global theme. Use:

    {% form_theme form _self %}
    {% block _user_email_widget %}
        {{ block('email_widget') }}
    {% endblock %}
    

    and rely on the bundle's default blocks for everything else. This keeps the Bootstrap styling intact while letting you specialize.

  • Integrating with sibling Snowcap bundles. snowcap/core-bundle, snowcap/menu-bundle, and the admin bundle all assume this bundle's templates are loaded. Load them in dependency order in AppKernel.php and keep Bootstrap CSS at the top of your <head> — the admin templates add their own classes that require Bootstrap's grid to render correctly.

Gotchas and Tips

  • It is effectively abandoned. Last tagged release is from September 2015, with a single star and no dependents. Treat it as frozen: no security patches, no Symfony 3/4/5 support, and PHP 8 will break on each() / mcrypt-era usages in transitive dependencies. Plan a migration path (native Symfony form themes or symfony/ux + bootstrap) rather than building new features on top of it.

  • Bootstrap version mismatch. The bundle targets Bootstrap 2.x/3.x markup (col-xs-*, pull-right, glyphicons or early Font Awesome). Dropping Bootstrap 4/5 CSS on top of its markup produces very broken layouts because col-xs-* and pull-* were removed. Pin Bootstrap 3.x in your asset manifest or expect to rewrite templates.

  • AppKernel load order. If you get "twig loader not found" or missing template blocks, it's almost always bundle order. SnowcapCoreBundle should load before SnowcapBootstrapBundle, and the bootstrap menu renderer requires KnpMenuBundle to be registered already.

  • Form theme order is silent. Symfony won't warn you if two themes define form_row — the first wins. When your Bootstrap grid suddenly drops out of a form, diff the block names in fields.html.twig against your override before assuming the bundle broke.

  • Template override path must match exactly. Overrides live at app/Resources/SnowcapBootstrapBundle/views/<path>. One typo in SnowcapBootstrapBundle (capitalization included) and Symfony will silently use the vendor template — a classic two-hour debugging session. Use app/console debug:twig to confirm which file is actually being loaded.

  • Cache is aggressive. After editing a bundle template override, always run app/console cache:clear --env=dev (and --no-warmup if warmup itself errors due to a bad template). Symfony 2's Twig cache is far less forgiving than modern versions.

  • Extension points are limited. There's no DI service or compiler pass worth using here; the bundle is essentially a pile of Twig templates plus a small set of form types. Customize through template overrides and form_theme, not through services — attempting to extend it via configuration usually turns out to be unsupported and gets wiped by the next update.

  • When to walk away. If you're on Symfony ≥ 3, or if you need Bootstrap 4/5, or if the project is greenfield — do not use this bundle. Recreate the ~200 lines of Bootstrap form theme you actually need in your own AppBundle, and you'll have fewer moving parts and a supported code path.

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.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
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