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

Navigation Bundle Laravel Package

bigfoot/navigation-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

First Steps

  1. Installation Add the bundle via Composer (if still functional):

    composer require c2is/bigfoot-navigation-bundle
    

    Register the bundle in AppKernel.php (Symfony 2.x) or config/bundles.php (Symfony 3.x+):

    // AppKernel.php
    new C2is\BigfootNavigationBundle\BigfootNavigationBundle(),
    
  2. Configuration Locate config.yml or bigfoot_navigation.yml in config/packages/ (or app/config/ for older versions). Define your navigation structure:

    bigfoot_navigation:
        menu:
            items:
                - label: 'Home'
                  uri: '/'
                - label: 'About'
                  uri: '/about'
    
  3. First Use Case Render the navigation in a Twig template:

    {{ render(navigation.menu) }}
    

    Or fetch it programmatically:

    $menu = $this->get('bigfoot.navigation.manager')->getMenu();
    

Implementation Patterns

Core Workflows

  1. Dynamic Menu Building Use Twig extensions or PHP services to conditionally load menu items:

    {% if app.user %}
        {{ render(navigation.menu, {'user': app.user}) }}
    {% endif %}
    
  2. Nested Menus Define hierarchical menus in YAML:

    items:
        - label: 'Products'
          uri: '#'
          children:
              - label: 'Product 1'
                uri: '/product/1'
    
  3. Integration with Security Combine with Symfony’s security component to hide/show items:

    items:
        - label: 'Admin'
          uri: '/admin'
          roles: [ROLE_ADMIN]
    
  4. Event-Driven Extensions Listen to bigfoot.navigation.build events to modify menus dynamically:

    // src/EventListener/NavigationListener.php
    public function onBuildMenu(BuildMenuEvent $event) {
        $event->addItem(new MenuItem('Custom Item', '/custom'));
    }
    

Best Practices

  • Separate Configs: Use environment-specific YAML files (e.g., bigfoot_navigation_dev.yml).
  • Reusable Components: Extract menu logic into services for modularity.
  • Caching: Leverage Symfony’s cache system for performance:
    bigfoot_navigation:
        cache: true
    

Gotchas and Tips

Common Pitfalls

  1. Deprecated Symfony Version The package was last updated in 2014 and may not support Symfony 4.5+ or PHP 7.4+. Test thoroughly or fork the repo.

  2. YAML Parsing Quirks

    • Indentation must be exact (2 spaces per level).
    • Use quotes for labels with special characters (e.g., label: 'O’Reilly').
  3. Twig Rendering Issues If {{ render(navigation.menu) }} fails, ensure:

    • The Twig extension is registered (check services.yaml).
    • The menu is properly fetched via the manager service.
  4. Event System Limitations The BuildMenuEvent may not be fully documented. Inspect the source (src/Event/BuildMenuEvent.php) for available methods.

Debugging Tips

  • Dump Menu Structure:
    dump($this->get('bigfoot.navigation.manager')->getMenu());
    
  • Check for Typos: Validate YAML syntax with a linter (e.g., YAML Lint).
  • Clear Cache: After config changes, run:
    php bin/console cache:clear
    

Extension Points

  1. Custom Menu Builders Override the default builder by implementing C2is\BigfootNavigationBundle\Builder\MenuBuilderInterface.

  2. Database-Backed Menus Extend the bundle to fetch menus from a database (e.g., via a custom loader service).

  3. Frontend Frameworks Output menus as JSON for React/Vue:

    {{ navigation.menu|json_encode|raw }}
    
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.
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
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle