# assertRequiredPluginsPresent Plugin Struktur ab 5.2

**URL:** https://forum.shopware.com/t/assertrequiredpluginspresent-plugin-struktur-ab-5-2/48893
**Category:** Programmierung
**Created:** [17. Oktober 2017 um 18:07 UTC](https://forum.shopware.com/t/assertrequiredpluginspresent-plugin-struktur-ab-5-2/48893 "2017-10-17T18:07:22Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![mdsw](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mdsw](https://forum.shopware.com/u/mdsw)
#### Post date: [17. Oktober 2017 um 18:07 UTC](https://forum.shopware.com/t/assertrequiredpluginspresent-plugin-struktur-ab-5-2/48893/1 "2017-10-17T18:07:22Z")

</div>

Hallo,&nbsp;

würde gerne auf ein Plugin prüfen. In der alten Plugin-Struktur ging das mit&nbsp;

```
 assertRequiredPluginsPresent

```

Wie macht man das nun in der neuen Plugin-Struktur?

---

<div class="post-metadata">

### Author: ![shyim](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/shyim/32/7681_2.png) [@shyim](https://forum.shopware.com/u/shyim)
#### Post date: [18. Oktober 2017 um 06:28 UTC](https://forum.shopware.com/t/assertrequiredpluginspresent-plugin-struktur-ab-5-2/48893/2 "2017-10-18T06:28:15Z")

</div>

Schau Mal hier&nbsp;[https://developers.shopware.com/developers-guide/plugin-system/#require-other-plugins](https://developers.shopware.com/developers-guide/plugin-system/#require-other-plugins)

---

<div class="post-metadata">

### Author: ![mdsw](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mdsw](https://forum.shopware.com/u/mdsw)
#### Post date: [18. Oktober 2017 um 11:13 UTC](https://forum.shopware.com/t/assertrequiredpluginspresent-plugin-struktur-ab-5-2/48893/3 "2017-10-18T11:13:11Z")

</div>

Hi Shyim,&nbsp;vielen Dank für den Link. So wie das aussieht betrifft das aber die plugin.xml. Ich würde gerne in der Plugin PHP Datei auf andere Plugins abfragen.

&nbsp;

---

<div class="post-metadata">

### Author: ![daMardl](https://avatars.discourse-cdn.com/v4/letter/d/58956e/32.png) [@daMardl](https://forum.shopware.com/u/daMardl)
#### Post date: [31. März 2018 um 20:24 UTC](https://forum.shopware.com/t/assertrequiredpluginspresent-plugin-struktur-ab-5-2/48893/4 "2018-03-31T20:24:27Z")

</div>

@mdsw‍

W‍eiß nicht ob das noch aktuell ist, aber ich würde die&nbsp;

```
 assertRequiredPluginsPresent

```

einfach in 5.2 Version umsetzen.

```
    protected function assertRequiredPluginsPresent(array $plugins)
    {
        $pluginRepository = Shopware()->Models()->getRepository(\Shopware\Models\Plugin\Plugin::class);
        foreach ($plugins as $plugin) {
            $test = $pluginRepository->findOneBy(['name' => $plugin, 'active' => 1]);
            if (!$test) {
                return false;
            }
        }

        return true;
    }

```

Die Funktion könntest in deiner&nbsp;5.2 Bootrap-Plugin einbauen und verwenden. Vielleicht macht sie Shopware oder ein Merge-Request Erfahrener Community-Programmierer (Shyim&nbsp; ![Wink](https://forum.shopware.com/plugins/CKEditor/plugins/smiley/images/wink.png "Wink")) ja mal in die „engine/Shopware/Components/Plugin.php“ rein. Dann könnte man sie zumindest in der 5.2-Bootstrap so verwenden, wie bisher auch.

Wenn du nur nachschauen möchtest, ob ein Plugin vorhanden ist, kannst natürlich das ganze auch in 2 Zeilen machen.

```
$plugin = Shopware()->Models()->getRepository(\Shopware\Models\Plugin\Plugin::class)->findOneBy(['name' => 'NeedetPlugin', 'active' => 1]);
if (!plugin) {
    return false;
})
/** 
* Do some stuff, when "NeedetPlugin" ist active
*/

```

Gruß  
daMardl

---

<div class="post-metadata">

### Author: ![daMardl](https://avatars.discourse-cdn.com/v4/letter/d/58956e/32.png) [@daMardl](https://forum.shopware.com/u/daMardl)
#### Post date: [31. März 2018 um 20:55 UTC](https://forum.shopware.com/t/assertrequiredpluginspresent-plugin-struktur-ab-5-2/48893/5 "2018-03-31T20:55:10Z")

</div>

Ich hab mal einen Merge-Request gestellt. Mal schauen.

> <https://github.com/shopware/shopware/pull/1593>

&nbsp;
