InstantPWA on Laravel
Laravel apps share a single Blade layout that every view extends, so InstantPWA only needs to go in one place: resources/views/layouts/app.blade.php. It sits alongside @vite or @mix asset directives and doesn't require any Artisan command or package.
Any Laravel 8+ app. If you set a Content-Security-Policy header via middleware, allow-list the InstantPWA script domain.
How to set it up
- 1
Open resources/views/layouts/app.blade.php
Or whichever Blade file renders your shared <head>.
- 2
Paste the snippet before </head>
It sits fine alongside @vite('resources/js/app.js') and doesn't need to go through the asset pipeline.
- 3
Clear the view cache
Run php artisan view:clear so the change shows up immediately in cached environments.
- 4
Deploy and verify
Open the production URL over HTTPS on a phone to confirm the popup fires.
Common tasks on Laravel
FAQ
Does it work with Laravel Livewire?+
Yes — Livewire's DOM diffing only touches wire:-scoped elements, so it never removes the head script.
Do I need to add it to a CSP policy?+
Only if your app sends a custom Content-Security-Policy header via middleware — in that case allow the InstantPWA script-src domain.