Share
Embed
Debugging Shopware Effectively: Tips, Tricks, and Hacks
Discover tips, tricks, and powerful debugging hacks that will help you diagnose Shopware issues quickly and spend less time chasing bugs.
Matheus Gontijo
June 05, 2026
Transcript
58 slides
-
Hello, I'm Matheus Gontijo 👋 🇧🇷🇧🇷🇧🇷 PHP Developer with +14
years experience (a lot of e-commerce) Big passions ❤️ community, Open Source, PHP, Symfony, Linux, remote work & football ⚽ -
What is debugging? 🐛 The process of finding, understanding, and
fixing errors in a computer program. -
Goal of this quick talk 🎯 ⚠️ Disclaimer [1]: no
time to dive deep into every single technique ⚠️ Disclaimer [2]: high chances that you are familiar with most of the techniques ✅ A different debugging perspective ✅ Introduce you to some lesser-known techniques -
Agenda? 📑 General PHP / PHP-FPM Database — MySQL /
MariaDB Shopware Symfony Twig -
Keep logs centralized 💡 web server (apache, nginx, caddy, etc...)
php php fpm MySQL / MariaDB php bin/console messenger:consume php bin/console scheduled-task:run etc... -
Should I debug in production? 💡 No 🚫🚫🚫 Use a
local or staging environment to avoid breaking things for real users. -
How can I reproduce an HTTP request with tons of
variables? 💡 -
curl 'https://mysite.com/Variant-product/SWDEMO10005.1' \ -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application -H 'accept-language: en-US,en;q=0.9,pt;q=0.8' \
-H 'cache-control: no-cache' \ -b 'timezone=Europe/Berlin; session-=dcuj5614ap9lqm0jhtn135shes' \ -H 'dnt: 1' \ -H 'pragma: no-cache' \ -H 'priority: u=0, i' \ -H 'referer: https://mysite.com/Clothing/Women/' \ -H 'sec-ch-ua: "Chromium";v="148", "Google Chrome";v="148", "Not/A)Brand";v="99"' \ -H 'sec-ch-ua-mobile: ?0' \ -H 'sec-ch-ua-platform: "Linux"' \ -H 'sec-fetch-dest: document' \ -H 'sec-fetch-mode: navigate' \ -H 'sec-fetch-site: same-origin' \ -H 'sec-fetch-user: ?1' \ -H 'upgrade-insecure-requests: 1' \ -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36' -
In the browser, I have no idea where data is
coming from... 💡 -
Keep Xdebug disabled, for performance reasons php.ini config xdebug.start_with_request =
1 xdebug.connect_timeout_ms = 10 # original is 200 -
print_r to string ✅ $data = print_r($rows, true); // [
// ... // 'aaa' => [ // ... // 'bbb' => [ // ... // 'ccc' => 'smith' // ], // ], // ], // ], if (stripos($data, 'smith') !== false) { $breakpoint = null; } foreach ($rows as $row) { -
quick and dirty: just write PHP conditions by hand 💡
if ( stripos($product->getName(), 'car') !== false && $customer->getId() === '019e409ff93672729d22fcef54ca2433' && in_array($myFlag, $allowedFlags) ) { $breakpoint = null; } -
Profiling 🕓 $start = microtime(true); // code here $total =
microtime(true) - $start; echo $total . PHP_EOL . PHP_EOL; // 22.1881122589898 -
[16-May-2026 09:07:41] [pool www] pid 39 script_filename = /app/public/index.php [0x00007f0cbce1a570]
read() /app/vendor/symfony/intl/Data/Bundle/Reader/BufferedBundleReader.php:38 [0x00007f0cbce1a420] read() /app/vendor/symfony/intl/Data/Bundle/Reader/BundleEntryReader.php:80 [0x00007f0cbce19f20] readEntry() /app/vendor/symfony/intl/ResourceBundle.php:58 [0x00007f0cbce19cd0] readEntry() /app/vendor/symfony/intl/Locales.php:43 [0x00007f0cbce19c20] exists() /app/vendor/shopware/core/System/Snippet/DataTransfer/Language/Language.php:29 [0x00007f0cbce19b50] validateLocale() /app/vendor/shopware/core/System/Snippet/DataTransfer/Language/Language.php:19 [0x00007f0cbce19ac0] __construct() /app/vendor/shopware/core/System/Snippet/Service/TranslationConfigLoader.php:59 [0x00007f0cbce197a0] load() /app/var/cache/dev_h9119bf599743e403c55e9cbc7f4ce680/ContainerRiyIYh7/Shopware_Core_KernelDevDebugCo [0x00007f0cbce19660] getTranslationConfigService() /app/var/cache/dev_h9119bf599743e403c55e9cbc7f4ce680/ContainerRiyIYh7/Shopwar [0x00007f0cbce195d0] {closure:ContainerRiyIYh7\Shopware_Core_KernelDevDebugContainer::getTranslationConfigService():12292}() /ap [0x00007f0cbce194f0] getMappedPluginName() /app/vendor/shopware/core/System/Snippet/Files/SnippetFileLoader.php:127 [0x00007f0cbce19390] getInactivePluginNames() /app/vendor/shopware/core/System/Snippet/Files/SnippetFileLoader.php:57 [0x00007f0cbce18e60] loadTranslationSnippets() /app/vendor/shopware/core/System/Snippet/Files/SnippetFileLoader.php:48 [0x00007f0cbce18dc0] loadSnippetFilesIntoCollection() /app/vendor/shopware/core/System/Snippet/Files/SnippetFileCollectionFactor [0x00007f0cbce18d00] createSnippetFileCollection() /app/var/cache/dev_h9119bf599743e403c55e9cbc7f4ce680/ContainerRiyIYh7/Shopwar [0x00007f0cbce18bc0] getSnippetFileCollectionService() /app/var/cache/dev_h9119bf599743e403c55e9cbc7f4ce680/ContainerRiyIYh7/Sho [0x00007f0cbce18b30] {closure:ContainerRiyIYh7\Shopware_Core_KernelDevDebugContainer::getSnippetFileCollectionService():12246}() [0x00007f0cbce18980] filter() /app/vendor/shopware/core/System/Snippet/SnippetService.php:114 [0x00007f0cbce185e0] getStorefrontSnippets() /app/vendor/shopware/core/Framework/Adapter/Translation/Translator.php:342 -
Logging 🕓 use Psr\Log\LoggerInterface; public function __construct(private LoggerInterface $logger) {}
$this->logger->debug('something!'); -
Stacktrace 💡 debug_print_backtrace(); #0 /app/vendor/shopware/core/Framework/Plugin/KernelPluginLoader/DbalKernelPlu #1 /app/vendor/shopware/core/Framework/Plugin/KernelPluginLoader/KernelPluginL #2 /app/vendor/shopware/core/Kernel.php(143): Shopware\Core\Framework\Plugin\K
#3 /app/vendor/shopware/core/Kernel.php(127): Shopware\Core\Kernel->boot() #4 /app/vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php(35): Shopwa #5 /app/vendor/autoload_runtime.php(32): Symfony\Component\Runtime\Runner\Symf #6 /app/public/index.php(10): require_once('/app/vendor/aut...') -
Nested arrays are hard to understand (especially when debugging OpenSearch)
[...] [...] [...] [...] [...] [...] [...] [...] [...] [...] [...] [...] [...] 'customFields' => [ 'cdnProvider' => 'cloudfront', 'cacheControl' => 'max-age=31536000', 'optimized' => true, 'imageProperties' => [ 'colorSpace' => 'sRGB', 'dpi' => 96, 'hasTransparency' => true, 'createdWith' => 'Adobe Illustrator', 'deepAssetTag' => [ 'tagId' => 'asset-tag-brand-001', 'tagName' => 'brand-asset', 'category' => 'manufacturer-logo', 'usage' => 'storefront', 'restrictions' => [ 'assetVersion' => [ -
adbario/php-dot-notation 💡 [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.price.listPrice.percentage.net] => 7.7 [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.price.listPrice.percentage.gross] => 7.7 [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.tax.id] =>
tax-001 [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.tax.name] => Standard Rate [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.tax.taxRate] => 19 [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.tax.customFields.taxCategory] => electronics [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.tax.customFields.euVatCompliant] => 1 [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.manufacturer.id] => mfr-samsung-001 [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.manufacturer.name] => Samsung Electronics [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.manufacturer.link] => https://www.samsung.com [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.manufacturer.description] => Global leader in consumer electronics [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.manufacturer.media.id] => media-mfr-001 [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.manufacturer.media.fileName] => samsung-logo [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.manufacturer.media.fileExtension] => png [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.manufacturer.media.mimeType] => image/png [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.manufacturer.media.fileSize] => 20480 [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.manufacturer.media.url] => https://cdn.techstyle.example.com/manufacturer/samsung-logo.png [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.manufacturer.media.thumbnails.small.width] => 80 [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.manufacturer.media.thumbnails.small.height] => 80 [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.manufacturer.media.thumbnails.small.url] => https://cdn.techstyle.example.com/thumbnail/sam [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.manufacturer.media.thumbnails.medium.width] => 300 [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.manufacturer.media.thumbnails.medium.height] => 300 [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.manufacturer.media.thumbnails.medium.url] => https://cdn.techstyle.example.com/thumbnail/sa [shop.catalog.rootCategory.parentCategory.childCategory.subCategory.productGroup.product.manufacturer.media.thumbnails.medium.metaData.altText] => Samsung Logo -
mysqldumps to diff data change 💡 mysqldump ... --extended-insert=false diff
before.sql after.sql -INSERT INTO `product_translation` VALUES [...] Lorem ipsum dolor sit amet, c [...] +INSERT INTO `product_translation` VALUES [...] consectetur adipiscing elitad [...] -
Time Id Command Argument 260519 17:36:00 4 Connect [email protected] on
db using SSL/TLS 4 Query select @@version_comment limit 1 4 Query select 1 from plugin limit 1 4 Quit 5 Connect [email protected] on db using TCP/IP 6 Connect [email protected] on db using TCP/IP 5 Query SELECT `key`, `value` FROM `app_config` 6 Query SELECT `key`, `value` FROM `app_config` 7 Connect [email protected] on db using TCP/IP 7 Query # dbal-plugin-loader SELECT `name`, `base_class` AS baseClass, IF(`active` = 1 AND `installed_at` IS NOT NULL, 1, 0) AS active, `path`, `version`, `autoload`, `managed_by_composer` AS managedByComposer, composer_name as composerName FROM `plugin` ORDER BY `installed_at` 8 Connect [email protected] on db using TCP/IP -
Reset MySQL data via rsync 💡 # expensive: full import
mysql < import-20g.sql # cheap: just rsync rsync -a volume/mysql_data_sample/ volume/mysql_data/ -
Doctrine: Connection.php ✅✅✅ vendor/doctrine/dbal/src/Connection.php // Connection::executeQuery // Connection::executeStatement if (stripos($sql,
'product_translation') !== false) { $breakpoint = null; } -
frosh/development-helper 🛠️ Friends of Shopware 🥰 Show twig files path
<!-- INCLUDE BEGIN @Storefront/storefront/base.html.twig (vendor/shopware/storefront/Resou <!-- INCLUDE BEGIN @Storefront/storefront/layout/header.html.twig (vendor/shopware/storefr <!-- INCLUDE BEGIN @Storefront/storefront/layout/header/actions/cart-widget.html.twig (ven <!-- INCLUDE BEGIN @Storefront/storefront/layout/header/actions/currency-widget.html.twig <!-- INCLUDE BEGIN @Storefront/storefront/layout/footer.html.twig (vendor/shopware/storefr <!-- INCLUDE BEGIN @Storefront/storefront/layout/footer/footer.html.twig (vendor/shopware/ -
Shopware DAL 🛠️ $result = $repo->search($criteria, $context); // xdebug: $criteria->getFilters();
// xdebug: $result->getEntities()->getElements(); -
Shopware DAL: EntitySearcher.php ✅ // vendor/shopware/core/Framework/DataAbstractionLayer/Dbal/EntitySearcher.php $data = print_r($rows, true);
if (stripos($data, 'my data') !== false) { $breakpoint = null; } foreach ($rows as $row) { -
php bin/console debug:* php bin/console debug:autowiring php bin/console debug:business-events php
bin/console debug:config php bin/console debug:container php bin/console debug:dotenv php bin/console debug:event-dispatcher php bin/console debug:messenger php bin/console debug:router php bin/console debug:scheduler php bin/console debug:serializer php bin/console debug:translation php bin/console debug:twig php bin/console debug:validator -
# list all services php bin/console debug:container # info about
a specific service php bin/console debug:container MyService -
php bin/console debug:container League\Flysystem\FilesystemOperator $administrationPrivateFilesystem alias for "administration.filesystem.private" League\Flysystem\FilesystemOperator $administrationPublicFilesystem
alias for "administration.filesystem.public" League\Flysystem\FilesystemOperator $checkoutPrivateFilesystem alias for "checkout.filesystem.private" Shopware\Core\Framework\DataAbstractionLayer\EntityRepository $paymentMethodRepository alias for "payment_method.repository" Shopware\Core\Framework\DataAbstractionLayer\EntityRepository $paymentMethodTranslationRepository alias for "payment_method_translation.repository" Shopware\Core\Framework\DataAbstractionLayer\EntityRepository $pluginRepository alias for "plugin.repository" Shopware\Core\Framework\DataAbstractionLayer\EntityRepository $pluginTranslationRepository alias for "plugin_translation.repository" Shopware\Core\Framework\DataAbstractionLayer\EntityRepository $productCategoryRepository alias for "product_category.repository" tag.repository Shopware\Core\Framework\DataAbstractionLayer\EntityRepository tax.repository Shopware\Core\Framework\DataAbstractionLayer\EntityRepository tax_provider.repository Shopware\Core\Framework\DataAbstractionLayer\EntityRepository tax_provider_translation.repository Shopware\Core\Framework\DataAbstractionLayer\EntityRepository tax_rule.repository Shopware\Core\Framework\DataAbstractionLayer\EntityRepository tax_rule_type.repository Shopware\Core\Framework\DataAbstractionLayer\EntityRepository -
php bin/console debug:container customer.repository Information for Service "customer.repository" ============================================= ----------------
---------------------------------------------------------------------------------------------- Option Value ---------------- ---------------------------------------------------------------------------------------------- Service ID customer.repository Class Shopware\Core\Framework\DataAbstractionLayer\EntityRepository Tags - Public yes Synthetic no Lazy no Shared yes Abstract no Autowired no Autoconfigured no Arguments Service(Shopware\Core\Checkout\Customer\CustomerDefinition) Service(Shopware\Core\Framework\DataAbstractionLayer\Read\EntityReaderInterface) Service(Shopware\Core\Framework\DataAbstractionLayer\VersionManager) Service(Shopware\Elasticsearch\Framework\DataAbstractionLayer\ElasticsearchEntitySearcher) Service(Shopware\Elasticsearch\Framework\DataAbstractionLayer\ElasticsearchEntityAggregator) Service(debug.event_dispatcher) Service(Shopware\Core\Framework\DataAbstractionLayer\Event\EntityLoadedEventFactory) Usages .Shopware\Core\Framework\DataAbstractionLayer\EntityRepository $customer.repository Shopware\Core\Framework\DataAbstractionLayer\EntityRepository $customerRepository Shopware\Core\Framework\Demodata\PersonalData\CleanPersonalDataCommand Shop are\Core\Content\Ne sletter\SalesChannel\Ne sletterS bscribeRo te -
php bin/console debug:router ------------------------------------------------------------------- ------------- -------- ------ ----------------------------------------- Name Method
Scheme Host Path ------------------------------------------------------------------- ------------- -------- ------ ----------------------------------------- api.action.access-key.integration GET ANY ANY /api/_action/access-key/intergration api.action.access-key.user GET ANY ANY /api/_action/access-key/user api.action.access-key.sales-channel GET ANY ANY /api/_action/access-key/sales-channel api.action.access-key.product-export GET ANY ANY /api/_action/access-key/product-export api.acl.privileges.get GET ANY ANY /api/_action/acl/privileges api.acl.privileges.additional.get GET ANY ANY /api/_action/acl/additional_privileges api.oauth.authorize POST ANY ANY /api/oauth/authorize api.oauth.token POST ANY ANY /api/oauth/token api.action.cache.info GET ANY ANY /api/_action/cache_info api.action.cache.index POST ANY ANY /api/_action/index api.action.cache.delete DELETE ANY ANY /api/_action/cache api.action.cache.delete-delayed DELETE ANY ANY /api/_action/cache-delayed api.action.cache.cleanup DELETE ANY ANY /api/_action/cleanup api.action.container-cache.delete DELETE ANY ANY /api/_action/container_cache api.action.custom-snippet GET ANY ANY /api/_action/custom-snippet -
Xdebug for twig templates ✅✅✅ // vendor/twig/twig/src/Extension/DebugExtension.php public static function
dump(Environment $env, $context, ...$vars) { $breakpoint = null; -
Thank you! 🙏 Questions? Feedback? You can always reach me
out! matheusgontijo.com