Bundle Installation
Transform your Symfony application into a Progressive Web App in just a few minutes.
Step 1: Install the Bundle
Install the bundle via Composer:
composer require spomky-labs/pwa-bundleStep 2: Create Configuration File
Create a configuration file to customize your PWA settings:
pwa:
manifest:
enabled: true
name: 'My Application'
short_name: 'MyApp'
serviceworker:
enabled: trueYou can start with minimal configuration (pwa: ~) and add settings as you build your PWA.
Step 3: Integrate in Your Templates
Add the PWA function to the <head> section of your base template:
{# PWA integration - add before closing </head> tag #}
{{ pwa() }}The {{ pwa() }} function automatically injects:
The Web App Manifest link
Service worker registration script
Theme color meta tags
Favicon links
Step 4: Clear Cache
Clear your Symfony cache to activate the bundle:
php bin/console cache:clearStep 5: Verify Installation
Visit your application in a browser and check:
Manifest: Open DevTools → Application tab → Manifest
Service Worker: Look in Application tab → Service Workers
Install Prompt: Visit your app on mobile or desktop - you should see an install option
What's Next?
Your Symfony application is now a basic PWA! Enhance it further:
Configure the manifest - Customize app name, icons, colors
Set up caching - Enable offline functionality
Add icons - Create app icons for all platforms
Configure the service worker - Control caching behavior
Add UX components - Integrate device APIs
Troubleshooting
PWA function not found
If you see "Unknown function pwa", ensure:
The bundle is properly installed (
composer.jsonshould include it)Cache is cleared (
php bin/console cache:clear)You're using Twig (not PHP templates)
Service worker not registering
Check that:
Your site is served over HTTPS (or localhost for development)
The service worker is enabled in
pwa.yamlNo JavaScript errors in the browser console
No install prompt appearing
The install prompt requires:
Valid manifest with required properties (name, icons, start_url)
Service worker successfully registered
HTTPS connection (except localhost)
User engagement (varies by browser)
See Application Information for complete requirements.
Last updated
Was this helpful?