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

Bigfoot Context Bundle Laravel Package

7rin0/bigfoot-context-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation Add the bundle to your composer.json:

    composer require 7rin0/bigfoot-context-bundle
    

    Register the bundle in app/AppKernel.php:

    new Sevenrin0\BigfootContextBundle\BigfootContextBundle(),
    
  2. Configuration Enable the bundle in config/packages/bigfoot_context.yaml (create if missing):

    bigfoot_context:
        enabled: true
        default_context: "default"
        contexts:
            default:
                theme: "BigfootDefaultThemeBundle"
                options: { /* theme-specific options */ }
    
  3. First Use Case Trigger context switching in a controller:

    use Sevenrin0\BigfootContextBundle\Context\ContextManager;
    
    public function switchContextAction(ContextManager $contextManager)
    {
        $contextManager->setContext('default');
        // Theme and options are now applied
    }
    

Where to Look First

  • Bundle Docs: Check Resources/doc/ for usage guides (if available).
  • ContextManager: Core class for managing contexts (src/Sevenrin0/BigfootContextBundle/Context/ContextManager.php).
  • Event Listeners: Hook into bigfoot.context.switch events for custom logic.

Implementation Patterns

Workflows

  1. Dynamic Context Switching Use middleware to set contexts based on user roles, locales, or other logic:

    use Sevenrin0\BigfootContextBundle\Event\ContextSwitchEvent;
    
    public function onContextSwitch(ContextSwitchEvent $event)
    {
        if ($event->getNewContext() === 'admin') {
            $event->setTheme('BigfootAdminThemeBundle');
        }
    }
    
  2. Theme-Specific Options Pass configuration per context:

    contexts:
        mobile:
            theme: "BigfootMobileThemeBundle"
            options:
                compact_mode: true
                hide_sidebar: false
    
  3. Twig Integration Access current context in templates:

    {% if app.request.attributes.get('_bigfoot_context') == 'dark' %}
        <link rel="stylesheet" href="{{ asset('css/dark-theme.css') }}">
    {% endif %}
    

Integration Tips

  • Dependency Injection: Inject ContextManager into services/controllers.
  • Event Subscribers: Extend functionality via bigfoot.context.switch events.
  • Asset Management: Use bigfoot_context.twig_extension to generate context-aware asset paths.

Gotchas and Tips

Pitfalls

  1. Missing Contexts Ensure all contexts are defined in config/packages/bigfoot_context.yaml. Undefined contexts will throw InvalidArgumentException.

  2. Theme Bundle Conflicts Verify theme bundles (e.g., BigfootDefaultThemeBundle) are installed and registered in AppKernel.php.

  3. Caching Issues Clear cache after changing contexts or themes:

    php bin/console cache:clear
    

Debugging

  • Check Current Context Log the active context in a controller:
    $contextManager->getCurrentContext();
    
  • Event Debugging Listen for bigfoot.context.switch events to trace context changes.

Extension Points

  1. Custom Context Providers Implement Sevenrin0\BigfootContextBundle\Context\ContextProviderInterface for dynamic context resolution.

  2. Theme Overrides Extend default themes by creating custom bundles (e.g., AppBigfootThemeBundle).

  3. Configuration Validation Add Symfony validator constraints to bigfoot_context.yaml for stricter context definitions.

Quirks

  • Symfony 3 Only: Not compatible with Symfony 4+ (check for forks or alternatives).
  • Limited Documentation: Assume minimal official docs; rely on source code and events for advanced use.
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky