# Shopware Plugin Shopware 5

**Shopware 5** features support legacy Shopware 5 projects, including Smarty templates, plugin bootstrap wiring, ExtJS templates, service IDs, and configuration assistance.

---

## Bootstrap lifecycle methods should return a result

**Feature ID:** `ShopwareBootstrapInspection`  
**Feature Page:** [Bootstrap lifecycle methods should return a result](https://espend.de/phpstorm/plugin/shopware#shopware-bootstrap-inspection)  

Reports Shopware 5 bootstrap lifecycle methods that omit the expected boolean return value.

### Code Examples

```php
# Before:
class Shopware_Plugins_Frontend_Acme_Bootstrap extends Shopware_Components_Plugin_Bootstrap
{
    public function install()
    {
        $this->subscribeEvent('Enlight_Controller_Action_PostDispatch', 'onPostDispatch');
    }
}
```

```php
# After:
class Shopware_Plugins_Frontend_Acme_Bootstrap extends Shopware_Components_Plugin_Bootstrap
{
    public function install()
    {
        $this->subscribeEvent('Enlight_Controller_Action_PostDispatch', 'onPostDispatch');

        return true;
    }
}
```

---

## Missing subscriber method

**Feature ID:** `ShopwareSubscriberMethodInspection`  
**Feature Page:** [Missing subscriber method](https://espend.de/phpstorm/plugin/shopware#shopware-subscriber-method-inspection)  

Reports subscribed event handlers that do not exist yet and offers creating the missing method.

### Code Examples

```php
# Event subscription:
public static function getSubscribedEvents(): array
{
    return [
        'Enlight_Controller_Action_PostDispatchSecure_Frontend_Detail' => 'onDetailPage',
    ];
}
```

```php
# Generated target:
public function onDetailPage(\Enlight_Event_EventArgs $args): void
{
}
```

---

## Smarty template completion

**Feature ID:** `SmartyFileCompletionProvider`  
**Feature Page:** [Smarty template completion](https://espend.de/phpstorm/plugin/shopware#smarty-file-completion-provider)  

Completes Shopware 5 Smarty template names, block names, controller actions, and snippet namespaces.

### Code Examples

```smarty
# Template and block completion:
{extends file="parent:frontend/detail/index.tpl"}

{block name="frontend_detail_index_buybox"}
    {$smarty.block.parent}
{/block}
```

---

## Shopware PHP helper completion

**Feature ID:** `ShopwarePhpCompletion`  
**Feature Page:** [Shopware PHP helper completion](https://espend.de/phpstorm/plugin/shopware#shopware-php-completion)  

Completes Shopware 5 helper calls for plugin config, plugin paths, attributes, and router parameters.

### Code Examples

```php
# Common Shopware 5 helpers:
$enabled = $this->Config()->get('active');
$pluginPath = $this->Path();
$router->assemble(['controller' => 'detail', 'action' => 'index']);
```

---

## plugin.json metadata completion

**Feature ID:** `ShopwareJsonCompletion`  
**Feature Page:** [plugin.json metadata completion](https://espend.de/phpstorm/plugin/shopware#shopware-json-completion)  

Completes Shopware plugin metadata keys, compatibility sections, labels, and changelog locales in `plugin.json`.

### Code Examples

```json
# plugin.json:
{
  "label": {
    "en": "Example plugin",
    "de": "Beispiel-Plugin"
  },
  "compatibility": {
    "minimumVersion": "5.7.0"
  }
}
```

---

## Backend menu controller completion

**Feature ID:** `ShopwareXmlCompletion`  
**Feature Page:** [Backend menu controller completion](https://espend.de/phpstorm/plugin/shopware#shopware-xml-completion)  

Completes backend controller and action names in Shopware menu XML files.

### Code Examples

```xml
# menu.xml:
<entry>
    <controller>Example</controller>
    <action>index</action>
</entry>
```

---

## Event and hook name completion

**Feature ID:** `LazySubscriberReferenceProvider`  
**Feature Page:** [Event and hook name completion](https://espend.de/phpstorm/plugin/shopware#lazy-subscriber-reference-provider)  

Completes Shopware event, hook, and lifecycle names in PHP subscribers and connects them to navigation.

### Code Examples

```php
# Subscriber map:
public static function getSubscribedEvents(): array
{
    return [
        'Enlight_Controller_Action_PostDispatchSecure_Frontend_Detail' => 'onDetail',
        'sArticles::sGetArticleById::after' => 'afterArticleLoaded',
    ];
}
```

---

## Shopware backend JavaScript completion

**Feature ID:** `ShopwareJavaScriptCompletion`  
**Feature Page:** [Shopware backend JavaScript completion](https://espend.de/phpstorm/plugin/shopware#shopware-java-script-completion)  

Completes classic backend snippets, controller names, and action targets in Shopware JavaScript code.

### Code Examples

```javascript
# Backend component code:
Ext.define('Shopware.apps.Acme.view.detail.Window', {
    extend: 'Enlight.app.Window',
    snippets: {
        title: '{s name="window/title"}Title{/s}'
    }
});
```

---

## Navigate between Smarty templates and blocks

**Feature ID:** `SmartyTemplateNavigation`  
**Feature Page:** [Navigate between Smarty templates and blocks](https://espend.de/phpstorm/plugin/shopware#smarty-template-navigation)  

Navigates from Smarty template and block references to matching parent templates, included files, and block implementations.

### Code Examples

```smarty
# Smarty reference:
{extends file="parent:frontend/detail/index.tpl"}
{include file="frontend/detail/buy.tpl"}

{block name="frontend_detail_buy"}
    {$smarty.block.parent}
{/block}
```

---

## Smarty template relationship linemarkers

**Feature ID:** `SmartyTemplateLineMarkerProvider`  
**Feature Page:** [Smarty template relationship linemarkers](https://espend.de/phpstorm/plugin/shopware#smarty-template-line-marker-provider)  

Shows navigation markers for Smarty template inheritance, includes, and block relationships.

### Code Examples

```smarty
# Template relationships:
{extends file="parent:frontend/detail/index.tpl"}
{include file="frontend/detail/buy.tpl"}

{block name="frontend_detail_index_buybox"}
    {$smarty.block.parent}
{/block}
```

---

## PHP subscriber and controller related targets

**Feature ID:** `PhpLineMarkerProvider`  
**Feature Page:** [PHP subscriber and controller related targets](https://espend.de/phpstorm/plugin/shopware#php-line-marker-provider)  

Shows related-target markers from PHP subscriber methods and controller actions to their Shopware event and template context.

### Code Examples

```php
# Subscriber target:
public static function getSubscribedEvents(): array
{
    return [
        'Enlight_Controller_Action_PostDispatchSecure_Frontend_Detail' => 'onDetail',
    ];
}

public function onDetail(\Enlight_Event_EventArgs $args): void
{
}
```

---

## Shopware backend JavaScript related targets

**Feature ID:** `ExtJsTemplateLineMarkerProvider`  
**Feature Page:** [Shopware backend JavaScript related targets](https://espend.de/phpstorm/plugin/shopware#ext-js-template-line-marker-provider)  

Shows related-target markers for classic backend JavaScript controllers, views, and templates.

### Code Examples

```javascript
# Backend view class:
Ext.define('Shopware.apps.Acme.view.detail.Window', {
    extend: 'Enlight.app.Window',
    alias: 'widget.acme-detail-window'
});
```

---

## Shopware service and parameter bridge

**Feature ID:** `ShopwareServiceBridge`  
**Feature Page:** [Shopware service and parameter bridge](https://espend.de/phpstorm/plugin/shopware#shopware-service-bridge)  

Provides Shopware service ids, service definitions, and default parameters to service-aware IDE features.

### Code Examples

```php
# Service-aware PHP usage:
$config = Shopware()->Container()->get('config');
$router = Shopware()->Container()->get('router');
```

---

