PhpStorm 2023.3 Help

Shopware

Shopware is a powerful and flexible application that can be used for building eCommerce experiences. It is based on a number of Symfony framework components, supported in PhpStorm through the core features and the Symfony Support plugin. The Shopware plugin adds additional support for developing Shopware eCommerce with PhpStorm. The source code for the Shopware plugin, as well as its issue tracker, can be found on GitHub.

Before you start

Before you start working with Shopware, make sure that the Symfony, PHP Annotations, and Shopware plugins are installed and enabled.

Enabling the Symfony Support plugin for a project

Having installed the Symfony and Shopware plugins, you need to explicitly enable the Symfony Support plugin for the project. After creating or opening a Symfony project, PhpStorm will display a notification message suggesting you enable the plugin.

Enable the Symfony Support plugin for a project

  1. Do any of the following:

    • Click the Enable plugin link in the notification message.

      Symfony Support plugin notification
    • In the Settings dialog (Ctrl+Alt+S) , navigate to PHP | Symfony and select the Enable Plugin for this Project checkbox.

  2. Restart PhpStorm for the changes to take effect.

Code Completion for Shopware

In the editor, press Ctrl+Space to invoke code completion for any of the following:

  • Subscribe to events provided by Shopware and other plugins as well as complete the names of controllers and hooks.

    Subscribe to Shopware event
  • Complete array keys and values when using setElement for forms.

    Shopware: complete form element
  • Complete array keys like module, controller and action when assembling a URL using the Enlight_Controller_Router 's assemble method.

    Shopware: assemble URL completion
  • Complete array keys when creating a plugin in Shopware and implementing the getInfo or Path methods.

    Shopware: getInfo completion
  • Complete block names when working with Smarty templates.

    Shopware Smarty completion
  • Complete the names of existing templates when including or extending other templates by means of the {extends file="..."} and {include file="..."} constructs.

    Shopware: extend template
  • Complete the names of files (such as scripts, Style Sheets, or images) when referencing them from a Smarty template.

    Shopware: complete template reference
  • Complete the snippets' and widgets' namespaces.

    Shopware: complete snippet
  • Complete the names of Doctrine repositories when calling getRepository.

    Shopware: complete Doctrine repository
  • Complete ExtJs models or controllers, for example when creating model associations.

    Shopware: Complete ExtJs model

Code Navigation for Shopware

To navigate to the declaration of an item, place the caret at its usage and press Ctrl+B. Alternatively, Ctrl+Click the usage.

  • Navigate to a controller, hook, or event.

    Shopware: navigate to event
  • Navigate to a module, controller, or action when assembling a URL using the Enlight_Controller_Router 's assemble method.

    Shopware: navigate to controller
  • Navigate to a Smarty template or a template's block definition.

    Shopware: navigate to Smarty block

    Within a block's definition, you can click the Implemented method icon or the Implementing method icon in the editor gutter to navigate to the templates where the corresponding block is implemented or overwritten.

Use the the Shopware icon icon in the editor gutter to navigate between related Shopware items.

  • From an event listener, navigate back to the subscribeEvent method where we're subscribing to the event.

    Shopware: navigate to subscribed event
  • To navigate between several related items (for example, a Smarty template, an include, and a related controller), click the Shopware icon in the editor gutter and choose the desired item from the popup menu.

    Shopware: navigate to related

Code inspection and quick-fixes for Shopware

When you subscribe to an event for which no listener is created, the Shopware plugin will provide a quick-fix Alt+Enter for generating an event handler stub.

Create event listener
Last modified: 25 March 2024