background

September 18, 2023

Small little Shopware utilities

Yireo Blog Post

For the past 3 years I have been diving into Shopware development. And while collaborating in projects, developing plugins and creating courseware, I have been slowly creating more and more utilities that are simply handy for development.

YireoTwigEnv - environment variables in Twig

Starting with the "most stable" but also the easiest of all, YireoTwigEnv exposes $_ENV variables (originating from various env files and/or other mechanisms) into Twig. Use a simple {{ dump(env) }} to display them. It's not fancy, but I needed it once, so here it is as an open source extension.

yireo-shopware6/shopware6-twig-env

YireoLumaSampleData - Magento samples in Shopware 6

This one makes me laugh: The default sample data of Shopware 6 is not fancy at all. So I started to look around for alternatives. While IceCAT is still on my agenda, I found an easier alternative: Somebody ported the Magento 2 sample data ("Luma") to a CSV that could be imported into WooCommerce. So I created an importer to import the same CSV into Shopware 6. The CSV business is mainly a proof-of-concept: With a bit of programming, you could import products from any source. However, the end result is that 2000 products with 500Mb of images are added to your Shopware 6 site. Work in progress though.

yireo-shopware6/shopware6-luma-sample-data

YireoListDecorators - Debugging service decorators

If you work with service decorators a lot, you might want to debug sometimes behaviour when a single service is decorated multiple times. You can use XDebug for this. You might also run the CLI bin/console debug:container --tag container.decorator but this only gives you partial info. The CLI debug:decorators (offered by this plugin) gives a proper listing with more details.

yireo-shopware6/shopware6-list-decorators

YireoListEntities - Listing entities with their names

When debugging Shopware entities in the CLI, the regular Symfony commands only give a partial view on the entities: You list their classes and that's it. This utility adds a command debug:entities that shows all entities in a table with their class and their name (which is what you inject via DI).

yireo-shopware6/shopware6-list-entities-cli

YireoAdditionalConfigCommands - Listing config values

By default, Shopware has commands for getting and setting specific values, but there is no command for listing all. This util adds a command system:config:list.

yireo-shopware6/shopware6-additional-config-commands

YireoAdditionalUserCommands - Listing and deleting admins

By default, Shopware allows to create an admin user and change its password. But what if the admin user is already there, how do you know? This plugin adds a list of admin users and allows to delete one.

yireo-shopware6/shopware6-additional-user-commands

YireoTwigInspector - OroTwigInspector for Shopware

The people of Oro have created a great inspector that adds itself to the Symfony Profiler toolbar and allows for analysing a Twig block with a mouse-click. We should have that for Shopware. This plugin aims to integrate this existing bundle into Shopware. Not working yet, I need some help here.

yireo-shopware6/shopware6-twig-inspector

YireoCommandSystemInfo - System info from the CLI

This plugin adds a CLI system:info to return useful information about Shopware. Got any ideas for additional data? Post a GitHub issue and we'll get to it together.

yireo-shopware6/shopware6-command-system-info

There should be more

I firmly believe that a healthy ecosystem should produce a lot more of these utilities (and open source them). Join me in improving the utilities above or create more utilities. Just grab a little bit of your professional time and share what you believe is useful to fellow developers.

As an example, Yireo is also organizing a Shopware hackathon on October 6th in Baarn, The Netherlands. Looking for pair programming on something cool? Let's work together. I'm personally looking to finalize my Luma importer and the Oro TwigInspector integration. Subscribe to join that hackathon now.

Posted on September 18, 2023

About the author

Author Jisse Reitsma

Jisse Reitsma is the founder of Yireo, extension developer, developer trainer and 3x Magento Master. His passion is for technology and open source. And he loves talking as well.

Sponsor Yireo

Upcoming events

Oct
28
Oct
31
LIEF Amsterdam

Looking for a training in-house?

Let's get to it!

We don't write too commercial stuff, we focus on the technology (which we love) and we regularly come up with innovative solutions. Via our newsletter, you can keep yourself up to date on all of this coolness. Subscribing only takes seconds.

Do not miss out on what we say

This will be the most interesting spam you have ever read

We don't write too commercial stuff, we focus on the technology (which we love) and we regularly come up with innovative solutions. Via our newsletter, you can keep yourself up to date on all of this coolness. Subscribing only takes seconds.