How shopwarelabs/swagadvancedsyncapi works
Project type and purpose
• This is a Shopware 6 plugin (“SwagAdvancedSyncAPI”) that extends the Shopware backend by exposing two custom REST endpoints for advanced stock‐ and price‐synchronization. It is not a standalone microservice, but a modular extension inside the Shopware monolith.
File structure
• Top level:
• composer.json / phpunit.xml.dist / LICENSE / README.md – standard plugin metadata and test configuration
• src/SwagAdvancedSyncAPI.php – plugin bootstrap class that registers the bundle with Shopware
• src/Api – HTTP controllers for each endpoint
• StockUpdateController.php
• PriceUpdateController.php
• src/Service – business logic layer
• StockUpdateService.php – handles stock updates, availability calculation, event dispatch
• PriceUpdateService.php – orchestrates price updates via Shopware’s SyncService
• src/Resources/config – XML configurations
• routes.xml – maps HTTP paths (/api/_action/swag-advanced-sync/…) to the controllers
• services.xml – defines each controller and service as injectable Symfony services
• src/Resources/Schema – JSON schemas for request validation
• tests – unit and integration tests around controllers and services
README for additional insights
• Defines two POST endpoints with sample payloads and responses.
• Describes the event system: two custom events (ProductNoLongerAvailableEvent, InvalidateProductCache).
• Installation instructions show how the plugin slots into the Shopware plugin system.