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

Test Bundle Laravel Package

dsi-iepg/test-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation Add the bundle to config/bundles.php:

    return [
        // ...
        Iepg\Bundle\TestBundle::class => ['all' => true],
    ];
    
  2. Configuration Create config/packages/iepg_test.yaml (note the iepg_test namespace from the bundle's TreeBuilder):

    iepgdsi:
        my_var_string: "test_value"
        my_array:
            - "item1"
            - "item2"
        my_integer: 42
    
  3. First Use Case Dump the configuration to verify:

    php bin/console config:dump-reference iepgdsi
    

    Expected output:

    TestBundle|iepgdsi|
    ├── my_var_string: string
    ├── my_array: array
    └── my_integer: int
    
  4. Accessing Config in Code Inject the IepgTestConfig service (if provided) or use the container:

    $this->container->getParameter('iepgdsi.my_var_string');
    

Implementation Patterns

Configuration-Driven Workflows

  1. Dynamic Configuration Use the bundle’s YAML config to drive behavior (e.g., feature flags, API endpoints):

    iepgdsi:
        features:
            experimental_ui: true
            debug_logs: false
    

    Access in a service:

    $isExperimentalEnabled = $this->container->getParameter('iepgdsi.features.experimental_ui');
    
  2. Route Integration Leverage the _tools route resource (as shown in tuto_tools.yaml):

    # config/routes/tuto_tools.yaml
    _tools:
        resource: '@TestBundle/Resources/config/routes.yaml'
        prefix: /admin/tools
    
    • Pattern: Use @TestBundle/Resources/config/routes.yaml to load bundle-specific routes.
    • Tip: Prefix routes to avoid conflicts (e.g., /admin/tools).
  3. Service Integration If the bundle provides services (e.g., iepg_test.service), bind them in services.yaml:

    services:
        App\Service\MyService:
            arguments:
                $testConfig: '%iepgdsi.my_var_string%'
    
  4. Event Listeners/Subscribers Attach listeners to bundle events (if documented). Example:

    // src/EventListener/TestBundleListener.php
    public static function getSubscribedEvents()
    {
        return [
            'iepg.test.event' => 'onTestEvent',
        ];
    }
    

Gotchas and Tips

Pitfalls

  1. Namespace Mismatch

    • The config key in YAML (iepgdsi) must match the TreeBuilder alias (iepg_test).
    • Fix: Run config:dump-reference to verify keys after changes.
  2. Route Overrides

    • If _tools routes conflict with existing paths, clear the cache:
      php bin/console cache:clear
      
  3. Missing Dependencies

    • The bundle assumes Symfony 5+. Test with:
      composer require symfony/*:^5.0
      
  4. Configuration Validation

    • The bundle may lack validation. Add custom validation in iepg_test.yaml:
      iepgdsi:
          my_integer: 22  # Must be > 0
      
    • Extend Configuration class to add constraints.

Debugging Tips

  1. Dump Config Use var_dump($this->container->getParameter('iepgdsi')); or:

    php bin/console debug:container | grep iepgdsi
    
  2. Route Debugging List all routes to verify _tools integration:

    php bin/console debug:router | grep tools
    
  3. Extension Points

    • Override Config: Use config/packages/overrides/iepg_test.yaml (Symfony 5+).
    • Extend Services: Override bundle services in config/services.yaml:
      services:
          Iepg\Bundle\TestBundle\Service\TestService:
              arguments:
                  $customValue: 'overridden'
      

Pro Tips

  1. Environment-Specific Config Use config/packages/iepg_test_{env}.yaml (e.g., iepg_test_dev.yaml):

    iepgdsi:
        debug_mode: true  # Only in dev
    
  2. Parameter Bag Access Access config via ParameterBagInterface:

    $config = $this->container->getParameter('iepgdsi');
    $arrayValue = $config['my_array'][0]; // "item1"
    
  3. Bundle-Specific Commands If the bundle adds commands (e.g., iepg:test), list them with:

    php bin/console list iepg
    
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.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle