
Building a Sylius Plugin with Webhook Sync, Service Decoration, and kernel.terminate
I already had a webhook sync module for Drupal Commerce . Drupal uses entity hooks, queue workers, and alter hooks. For Sylius, none of that applies. Sylius sits on Symfony. That means event subscribers, service decoration, console commands, and kernel.terminate . The plugin needed to feel like a Symfony bundle, not a ported Drupal module. Two Event Systems for Two Entity Types Products in Sylius are proper Sylius resources. They fire resource events: sylius.product.post_create , sylius.product.post_update , sylius.product_variant.post_create , etc. An event subscriber catches these: class ProductEventSubscriber implements EventSubscriberInterface { public static function getSubscribedEvents (): array { return [ 'sylius.product.post_create' => 'onProductCreate' , 'sylius.product.post_update' => 'onProductUpdate' , 'sylius.product.pre_delete' => 'onProductDelete' , 'sylius.product_variant.post_create' => 'onVariantCreate' , 'sylius.product_variant.post_update' => 'onVariantUpdate' , 'sy
Continue reading on Dev.to Webdev
Opens in a new tab



