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

Semantic Ui Bundle Laravel Package

codedmonkey/semantic-ui-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation Add the bundle via Composer:

    composer require codedmonkey/semantic-ui-bundle
    

    Enable the bundle in config/bundles.php:

    return [
        // ...
        CodedMonkey\SemanticUIBundle\CodedMonkeySemanticUIBundle::class => ['all' => true],
    ];
    
  2. Basic Usage Include the CSS/JS assets in your base template (base.html.twig):

    {{ semantic_ui_css() }}
    {{ semantic_ui_js() }}
    
  3. First Form Integration Use the form_theme directive in your Twig template:

    {% form_theme form 'CodedMonkeySemanticUIBundle:Form:fields.html.twig' %}
    

    Render a form:

    {{ form_start(form) }}
        {{ form_row(form.field) }}
        {{ form_row(form.submit) }}
    {{ form_end(form) }}
    

Implementation Patterns

Form Theming Workflow

  1. Extend Default Themes Override the default theme files in templates/bundles/CodedMonkeySemanticUIBundle/Form/:

    {% extends 'CodedMonkeySemanticUIBundle:Form:fields.html.twig' %}
    {% block form_row %}
        <div class="ui {{ form.vars.field_type }} field">
            {{ form_label(form) }}
            {{ form_widget(form) }}
            {{ form_errors(form) }}
        </div>
    {% endblock %}
    
  2. Dynamic Field Classes Use form_row_attr to add custom classes:

    {{ form_row(form.field, {'attr': {'class': 'ui fluid input'}}) }}
    
  3. Menu Integration Generate Semantic UI menus via Twig:

    {{ semantic_ui_menu({
        'items': [
            {'label': 'Home', 'link': path('home')},
            {'label': 'About', 'link': path('about')},
        ],
        'class': 'ui secondary menu'
    }) }}
    

Common Use Cases

  • Form Validation: Leverage form_errors() to display Semantic UI error messages.
  • Responsive Design: Use ui fluid classes for full-width forms/inputs.
  • Custom Components: Extend with custom Twig functions (e.g., semantic_ui_button()).

Gotchas and Tips

Pitfalls

  1. Archived Status The package is archived—expect no updates. Fork or migrate to alternatives like symfony/semantic-ui if critical features are missing.

  2. CSS/JS Conflicts Semantic UI’s default JS may conflict with other libraries (e.g., jQuery plugins). Load assets last in <head>/</body>.

  3. Twig Caching Clear Twig cache after theming changes:

    php bin/console cache:clear
    

Debugging Tips

  • Inspect Rendered HTML: Use browser dev tools to verify classes (e.g., .ui input).
  • Check Asset Paths: Ensure semantic_ui_css()/semantic_ui_js() point to valid paths (default: @CodedMonkeySemanticUIBundle/Resources/public/).

Extension Points

  1. Custom Assets Override asset paths in config/packages/coded_monkey_semantic_ui.yaml:

    coded_monkey_semantic_ui:
        css_path: '/custom/path/semantic.min.css'
        js_path: '/custom/path/semantic.min.js'
    
  2. Twig Extensions Extend the bundle’s SemanticUIExtension to add custom functions:

    // src/Twig/SemanticUIExtension.php
    class CustomSemanticUIExtension extends \CodedMonkey\SemanticUIBundle\Twig\SemanticUIExtension
    {
        public function getCustomFunction()
        {
            return 'custom output';
        }
    }
    

    Register in services.yaml:

    services:
        App\Twig\CustomSemanticUIExtension:
            tags: ['twig.extension']
    
  3. Symfony 5+ Compatibility The bundle may require manual adjustments for Symfony 5.3+ (e.g., form_theme syntax). Test thoroughly.

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.
cocosmos/filament-sticky-save-bar
patrickbussmann/oauth2-apple
3brs/enterprise-security-bundle
anousss007/vigilance
supportpal/eloquent-model
ardenexal/fhir-models
laravel-at/laravel-image-sanitize
romalytar/yammi-audit-log-laravel
ardenexal/fhir-validation
arshaviras/weather-widget
laravel-chronicle/core
sunchayn/nimbus
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope