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

Web Profiler Extra Bundle Laravel Package

effiana/web-profiler-extra-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation:

    composer require-dev elao/web-profiler-extra-bundle
    

    Add to AppKernel.php (Symfony 2.x):

    if (in_array($this->getEnvironment(), ['dev', 'test'])) {
        $bundles[] = new \Elao\WebProfilerExtraBundle\WebProfilerExtraBundle();
    }
    
  2. Enable Collectors (in config_dev.yml):

    web_profiler_extra:
        routing: { enabled: true, display_in_wdt: true }
        container: { enabled: true }
        twig: { enabled: true }
        assetic: { enabled: true }
    
  3. First Use Case: Access /_profiler/ in dev mode. New tabs appear for Routing, Container, Twig, and Assetic data.


Implementation Patterns

Daily Workflows

  1. Debugging Routes:

    • Use the Routing tab to verify route names, paths, and parameters.
    • Quickly check if a route exists or if a parameter is missing.
  2. Service Inspection:

    • Container tab lists all services with their tags, aliases, and scope.
    • Verify service availability or debug dependency injection issues.
  3. Twig Debugging:

    • Twig tab shows extensions, filters, and functions.
    • Validate if a custom Twig extension is registered or if a filter is missing.
  4. Asset Management:

    • Assetic tab lists all bundles, assets, and their dependencies.
    • Debug missing assets or verify asset compilation.

Integration Tips

  • Conditional Activation: Enable collectors only in dev/test environments to avoid performance overhead in production.

    web_profiler_extra:
        routing: { enabled: "%kernel.debug%" }
    
  • Custom Data: Extend collectors by implementing \Elao\WebProfilerExtraBundle\Collector\CollectorInterface. Example:

    class CustomCollector implements CollectorInterface {
        public function getName() { return 'custom'; }
        public function collect() { return ['data' => 'value']; }
    }
    

    Register in services.yml:

    services:
        app.custom_collector:
            class: AppBundle\Collector\CustomCollector
            tags:
                - { name: 'web_profiler_extra.collector' }
    
  • Exclude Sensitive Data: Filter out sensitive services from the Container tab:

    web_profiler_extra:
        container:
            exclude_services: ['security.token_storage', 'session']
    

Gotchas and Tips

Pitfalls

  1. Performance Overhead:

    • Collectors add minor overhead. Disable unused collectors in config_dev.yml:
      web_profiler_extra:
          assetic: { enabled: false }  # Disable if not needed
      
  2. Outdated Data:

    • The profiler caches data. Clear cache after changes:
      php bin/console cache:clear
      
  3. Symfony 3/4/5 Compatibility:

  4. Assetic Deprecation:

    • Assetic is deprecated in Symfony 4+. Replace with Webpack Encore or Vite if upgrading.

Debugging Tips

  • Missing Collectors: Ensure the bundle is registered in AppKernel.php and collectors are enabled in config_dev.yml. Check for typos in YAML keys (e.g., routing vs route).

  • Twig Errors: If the Twig tab is empty, verify Twig extensions are properly tagged:

    // In your Twig extension service definition
    tags:
        - { name: 'twig.extension' }
    
  • Container Data Truncation: Large containers may truncate data. Use exclude_services to limit output:

    web_profiler_extra:
        container:
            exclude_services: ['*doctrine*', '*monolog*']
    

Extension Points

  1. Custom Collector: Create a collector to log custom metrics (e.g., API calls, database queries):

    class ApiCollector implements CollectorInterface {
        public function collect() {
            return ['api_calls' => $this->apiService->getStats()];
        }
    }
    
  2. Override Templates: Customize the profiler UI by overriding templates in Resources/views/WebProfilerExtraBundle/. Example:

    app/Resources/WebProfilerExtraBundle/views/Collector/routing.html.twig
    
  3. Event Listeners: Hook into profiler events (e.g., web_profiler_extra.collect) to modify data dynamically:

    services:
        app.profiler_listener:
            class: AppBundle\EventListener\ProfilerListener
            tags:
                - { name: 'kernel.event_listener', event: 'web_profiler_extra.collect', method: 'onCollect' }
    
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