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

braincrafted/bootstrap-bundle

View on GitHub
Deep Wiki
Context7
## Getting Started
Install the package via Composer:
```bash
composer require braincrafted/bootstrap-bundle

Register the bundle in config/bundles.php:

return [
    // ...
    Braincrafted\Bundle\BootstrapBundle\BootstrapBundle::class => ['all' => true],
];

For Laravel integration, publish the assets and configuration:

php artisan vendor:publish --provider="Braincrafted\Bundle\BootstrapBundle\BootstrapBundle" --tag=config
php artisan vendor:publish --provider="Braincrafted\Bundle\BootstrapBundle\BootstrapBundle" --tag=assets

First Use Case: Leverage the new button Twig function for Bootstrap-styled buttons:

{{ button('Save', {'type': 'primary', 'icon': 'fa fa-save'}) }}

Implementation Patterns

Form Handling

Use the updated form themes with Symfony 2.6+ compatibility:

{% form_theme form '_braincrafted_bootstrap3_layout.html.twig' %}
  • Replace form.resources with form_themes in your configuration.

Twig Extensions

Leverage new Twig functions for common Bootstrap components:

{# Button with icon #}
{{ button('Submit', {'type': 'success', 'icon': 'fa fa-check'}) }}

{# Button link #}
{{ button_link('Link', {'href': '/path', 'type': 'info'}) }}

{# Icons with custom sets #}
{{ icon('fa fa-cog', {'set': 'font-awesome'}) }}

JavaScript Integration

Use the updated ScriptHandler for HHVM compatibility:

// Dynamically remove fields with event handling
$('.remove-field').on('click', function() {
    var $field = $(this).closest('.field-wrapper');
    $field.remove();
    // Event now fires after removal
    $field.trigger('removed.field');
});

Form Translations

Utilize the choice_translation_domain option for translated form choices:

$builder->add('role', ChoiceType::class, [
    'choices' => $roles,
    'choice_translation_domain' => 'messages',
]);

Asset Management

Publish and use the updated assets:

{% block stylesheets %}
    {{ parent() }}
    <link href="{{ asset('bundles/braincraftedbootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
{% endblock %}

Gotchas and Tips

Breaking Changes

  • Symfony 2.6+ Compatibility: Ensure your Symfony version is ≥2.6. If using Symfony 3.0, verify compatibility (PR #414).
  • Twig Deprecations: Some Twig functions may be deprecated (PR #399). Check the migration guide for details.
  • sameas Attribute: Replaced with same in HTML attributes (PR #417).

Debugging

  • Missing ul Tag: If lists appear broken, ensure you’re using the latest Twig templates (PR #367).
  • HHVM Issues: If JavaScript fails, verify the ScriptHandler fix (PR #384) is applied.
  • Form Theme Keyword: Update form.resources to form_themes in your configuration files.

Extension Points

  • Custom Icon Sets: Extend the icon helper to support additional icon libraries (PR #392).
  • Event Handling: Customize the removed.field event for dynamic field removal logic (PR #397).
  • Twig Functions: Add new Twig functions by extending the BootstrapExtension class.

Performance

  • JavaScript Deprecations: Update .size() calls to modern equivalents (PR #404) for better compatibility.
  • Asset Bundling: Use Laravel Mix or Webpack to optimize Bootstrap JS/CSS assets.

Configuration

  • Translation Domains: Always specify choice_translation_domain for multilingual forms (PR #382).
  • URL Attribute: Prefer the url option over href for dynamic links (PR #385).

NO_UPDATE_NEEDED was not applicable due to significant new features, breaking changes, and improvements.
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.
calmfox/watch-sylius
damienfern/grpc-symfony-bundle
atoolo/index-bundle
atoolo/genai-bundle
coprotoai/laravel-ticket
davidjln/llm-carbon-bundle
cryonighter/valid-request-bundle
coolms/taxonomy-bundle
coolms/field-bundle
articulate-orm/symfony
aaix/laravel-tall-architect
ephoto/akeneo-connector
emmanuelballery/eb-plantumlbundle
emielburgman/symfony-visitor-beacon
emielburgman/symfony-visit-storage
emielburgman/symfony-security-headers
emielburgman/symfony-log-viewer
emarref/xdebug-bundle
emarref/pubnub-bundle
elriseio/finance-money-bundle