Zum Inhalt springen

Progressive Web Apps with Symfony: Service Workers, Offline Capability, and GDPR

Veröffentlicht am Dec 15, 2025 | ca. 2 Min. Lesezeit |

Progressive Web Apps combine the reach of the web with app-like experiences. Three core requirements: HTTPS, a Web App Manifest, and a Service Worker.

Web App Manifest: JSON file defining the app's name, icons, theme color, and start URL. Symfony serves it as a JSON response from a controller. Add <link rel="manifest"> to the base template.

Service Worker: Background script that intercepts network requests. Common caching strategies:

  • Cache-First: Serve from cache, fall back to network (ideal for static assets)
  • Network-First: Try network, fall back to cache (ideal for API endpoints)
  • Stale-While-Revalidate: Serve cached version immediately, update cache in background (ideal for blog posts)

Offline page: The Service Worker can serve a custom /offline.html when both cache and network are unavailable.

GDPR: Service Workers are inherently GDPR-friendly — they cache data already transmitted. Push notifications require explicit browser opt-in (the browser dialog counts as GDPR consent). Mention Service Worker usage in your privacy policy.

PWA audit: Note that the PWA category was removed from Lighthouse v12.0 (May 2024). PWA checks are no longer scored as a separate Lighthouse category. Use Chrome DevTools (Application tab) or tools like pwabuilder.com to verify PWA requirements. Aim for proper icon sizes (192x192, 512x512), a valid manifest, and confirmed Service Worker registration.

Thomas Wunner

Thomas Wunner

Certified IT specialist for application development with an instructor qualification and over 14 years of experience building scalable web applications with Symfony and Shopware. When not coding, Thomas volunteers as a lifeguard with the Wasserwacht, performs as a DJ, and explores the countryside on his motorbike.

Kommentare

Kommentare werden von Remark42 bereitgestellt. Beim Laden werden Daten an unseren Kommentar-Server übertragen.