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

Clover2Lcov Bundle Laravel Package

bwen/clover2lcov-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Steps

  1. Installation

    composer require bwen/clover2lcov-bundle
    

    Register the bundle in config/bundles.php:

    return [
        // ...
        Bwen\Clover2LcovBundle\Clover2LcovBundle::class => ['all' => true],
    ];
    
  2. First Use Case Run the command to convert a clover.xml file to lcov.info:

    php bin/console convert:clover2lcov path/to/clover.xml path/to/lcov.info
    
    • Verify output with genhtml lcov.info (requires lcov CLI tools).

Where to Look First

  • Command Reference: php bin/console listconvert:clover2lcov.
  • Configuration: Check config/packages/bwen_clover2lcov.yaml (if created).
  • Source: src/Command/ConvertClover2LcovCommand.php for customization hooks.

Implementation Patterns

Workflows

  1. CI/CD Integration Add to .github/workflows/coverage.yml:

    - name: Convert Clover to Lcov
      run: php bin/console convert:clover2lcov build/clover.xml build/lcov.info
    - name: Upload to Codecov
      uses: codecov/codecov-action@v3
      with:
        file: build/lcov.info
    
  2. Laravel-Specific Usage

    • Use Artisan::call() in a custom command or service:
      Artisan::call('convert:clover2lcov', [
          'input' => storage_path('logs/clover.xml'),
          'output' => storage_path('logs/lcov.info'),
      ]);
      
  3. Pre-Processing Chain with other tools (e.g., phpunit --coverage-clover=clover.xml):

    phpunit --coverage-clover=clover.xml && \
    php bin/console convert:clover2lcov clover.xml lcov.info
    

Integration Tips

  • Symfony Flex: Autoloads without manual registration in modern Symfony.
  • Environment Variables: Override paths via CLOVER_INPUT_PATH/CLOVER_OUTPUT_PATH in .env.
  • Event Listeners: Extend functionality by subscribing to console.command events (see Gotchas).

Gotchas and Tips

Pitfalls

  1. File Permissions Ensure PHP process has write access to the output path. Debug with:

    chmod -R 777 build/  # Temporary fix (avoid in production)
    
  2. Clover XML Validity Invalid XML (e.g., malformed tags) crashes the command. Validate with:

    xmllint --noout clover.xml
    
  3. Lcov Toolchain genhtml requires lcov and graphviz. Install via:

    sudo apt-get install lcov graphviz  # Debian/Ubuntu
    

Debugging

  • Verbose Mode: Add --verbose to the command for debug output.
  • Log Level: Set Bwen\Clover2LcovBundle\Clover2LcovBundle::DEBUG in config/bundles.php for trace logs.

Extension Points

  1. Custom Conversion Logic Override the command class (e.g., app/Command/CustomConvertCommand) and extend:

    use Bwen\Clover2LcovBundle\Command\ConvertClover2LcovCommand;
    class CustomConvertCommand extends ConvertClover2LcovCommand {
        protected function execute(InputInterface $input, OutputInterface $output) {
            // Pre/post-processing logic
            parent::execute($input, $output);
        }
    }
    
  2. Event Dispatching Listen for console.command.clover2lcov events to hook into conversion:

    // src/EventListener/CloverListener.php
    public function onCloverConvert(CloverConvertEvent $event) {
        $event->setOutputPath($event->getOutputPath() . '.custom');
    }
    
  3. Configuration Override default paths in config/packages/bwen_clover2lcov.yaml:

    bwen_clover2lcov:
        input_path: '%kernel.project_dir%/var/clover.xml'
        output_path: '%kernel.project_dir%/var/lcov.info'
    
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