namespace SwagBasicExample\Subscriber;
use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityLoadedEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Shopware\Storefront\Page\Navigation\NavigationPageLoadedEvent;
use Psr\Log\LoggerInterface;
use SebastianBergmann\Exporter\Exporter;
class MySubscriber implements EventSubscriberInterface
private LoggerInterface $logger;
public function __construct(
public static function getSubscribedEvents(): array
// Return the events to listen to as array like this: <event to listen to> => <method to execute>
NavigationPageLoadedEvent::class => 'onNavigationPage'
public function onNavigationPage(NavigationPageLoadedEvent $event)
$exporter = new Exporter;
$this->logger->info($exporter->export('hello, world!'));