Shopware Extension Verifier: A Comprehensive Guide for Developers

Shopware Extension Verifier

Developing Shopware extensions comes with the responsibility of ensuring code quality, compatibility, and adherence to best practices. Fortunately, Shopware offers a powerful tool: Extension Verifier. This tool allows developers to easily validate and format their plugins, automate fixes, and ensure that the code adheres to Shopware’s guidelines.

In this guide, we’ll walk through how to set up and use the Shopware Extension Verifier in your development process, covering installation, commands, and practical examples.

What is Shopware Extension Verifier?

The Shopware Extension Verifier is a command-line tool designed to analyze and improve Shopware plugins. It helps developers identify issues, format their code according to Shopware’s standards, and even fix common errors automatically.

Key Features

  • Check Plugin Quality: Analyze the plugin for deprecated features and coding violations.
  • Auto Fix Issues: Automatically resolve known issues in the plugin code.
  • Format Code: Format code according to Shopware’s official guidelines.
  • Upgrade Twig Templates: Use AI to upgrade and improve Twig templates (experimental).

Installation Guide

Using Docker (Recommended)

You don’t need to install anything locally; simply run the verifier via Docker:

docker run --rm ghcr.io/shopwarelabs/extension-verifier:latest

This command will pull and run the latest image of the extension verifier in a Docker container.

Using PHAR (Alternative)

If you’re not using Docker, you can download the PHAR file and run it with PHP:

curl -sSL https://github.com/shopwareLabs/extension-verifier/releases/latest/download/sw-extension-verifier.phar -o verifier.phar
php verifier.phar [command] [path]

Available Commands & What They Do

1. check

Purpose: Analyze your Shopware plugin for deprecated features, coding standard violations, and best practices.

Usage:

sw-extension-verifier check [path] [flags]

Flags:

  • --check-against [highest|lowest|6.5.0.0]: Set Shopware version compatibility.
  • --only phpstan,eslint,...: Run only specific tools.
  • --reporter summary|json|github|junit|markdown: Select output format.

Docker Example:

docker run --rm -v "$(pwd)/MyPlugin:/app" ghcr.io/shopwarelabs/extension-verifier:latest check /app

2. fix

Purpose: Automatically fixes known issues in your plugin code.

Usage:

sw-extension-verifier fix [path]

Docker Example:

docker run --rm -v "$(pwd)/MyPlugin:/app" ghcr.io/shopwarelabs/extension-verifier:latest fix /app

3. format

Purpose: Formats your plugin code to follow Shopware’s coding style and structure.

Usage:

sw-extension-verifier format [path]

Docker Example:

docker run --rm -v "$(pwd)/MyPlugin:/app" ghcr.io/shopwarelabs/extension-verifier:latest format /app

4. twig-upgrade (Experimental)

Purpose: Uses AI to assist in upgrading Twig templates to newer syntax or best practices.

Usage:

sw-extension-verifier twig-upgrade [path]

Docker Example:

docker run --rm -v "$(pwd)/MyPlugin:/app" ghcr.io/shopwarelabs/extension-verifier:latest twig-upgrade /app

5. completion

Purpose: Enables command-line autocompletion for your shell.

Usage:

sw-extension-verifier completion [bash|zsh|fish|powershell]

6. help

Purpose: Displays detailed help and usage for a specific command.

Usage:

sw-extension-verifier help [command]

Best Practices for Using Shopware Extension Verifier

  • Run check before submission: Ensure your plugin is ready for the Shopware Store.
  • Use format regularly: Maintain code consistency and style.
  • Leverage fix: Save time by letting the verifier auto-fix known problems.
  • Backup before using twig-upgrade: As it’s experimental, always back up your code first.

Real-World Example

Assuming your plugin is located at:

E:/sw6/plugin/MoorlCmsTwig

Open Git Bash or PowerShell and navigate to the plugin directory:

Git Bash Example:

cd "/e/sw6/plugin"
docker run --rm -v "$(pwd)/MoorlCmsTwig:/app" ghcr.io/shopwarelabs/extension-verifier:latest check /app

PowerShell Example:

cd "E:\sw6\plugin"
docker run --rm -v "${PWD}/MoorlCmsTwig:/app" ghcr.io/shopwarelabs/extension-verifier:latest check /app

Conclusion

The Shopware Extension Verifier is a powerful utility for any developer working with Shopware plugins. Whether you’re preparing a plugin for the Shopware Store or maintaining internal extensions, this tool can greatly improve your workflow, catch issues early, and ensure compliance with Shopware standards.

Please contact us at manish@bay20.com or call us at +91-8800519180 / +91-9582784309 for any support related to shopware. You can also visit the Shopware development page to check the services we offer.