Download the PHP package foxws/laravel-pwa without Composer
On this page you can find all versions of the php package foxws/laravel-pwa. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download foxws/laravel-pwa
More information about foxws/laravel-pwa
Files in foxws/laravel-pwa
Package laravel-pwa
Short Description PWA manifest and Blade directives for Laravel.
License MIT
Homepage https://github.com/foxws/laravel-pwa
Informations about the package laravel-pwa
Laravel PWA
A minimal, opinionated Progressive Web App (PWA) package for Laravel. It provides Blade directives for the PWA head and service worker registration, and an Artisan command to generate your manifest.json and publish a sw.js stub.
The included service worker uses a network-first strategy for navigation and cache-first for static assets, while intentionally bypassing the cache for Inertia.js (X-Inertia) and Livewire (X-Livewire) requests to prevent stale responses.
See the full documentation (or browse Configuration.
Installation
Publish the config file:
Usage
Blade directives
Add @pwaHead inside your <head> and @pwaSw just before </body>:
This renders the theme-color meta tag, apple-touch-icon, manifest link, and the service worker registration script.
Both directives accept optional overrides:
Or use them as Blade components:
The @pwaSw directive automatically picks up the CSP nonce from Vite::cspNonce() when set.
Icons
Icons are defined in a dedicated icons array in config/pwa.php, separate from the manifest. Each entry supports a disk key pointing to any configured Laravel filesystem disk. The src URL is resolved at generation time via Storage::disk()->url(). Set disk to null to fall back to path used as-is.
The default configuration assumes three icons — a mobile icon (192×192), a desktop icon (512×512), and an apple-touch-icon. Create the storage symlink and place all files there:
You can override each icon independently via .env:
For S3 or other remote disks, set the respective _DISK variable to the disk name — the URL will be resolved accordingly. Each icon can live on a different disk.
Generating the manifest and service worker
This writes public/manifest.json from your config, and copies the sw.js stub to public/sw.js. Both paths are configurable via config/pwa.php.
The service worker serves an offline fallback page from public/offline.html. You must create this file yourself — see examples/offline.html for a starting point.
Disabling the service worker
Set PWA_ENABLED=false in your .env to disable the service worker in local or staging environments. When disabled, pwa:generate writes a self-unregistering service worker instead — on the next page load, any previously installed SW will silently clear its caches and remove itself. No Blade changes are required.
The @pwaHead directive and manifest.json are unaffected; only the service worker behaviour changes.
Configuration
Any key set to null in the manifest array is omitted from the generated JSON. Advanced keys such as shortcuts, screenshots, and categories can be added to the manifest array as needed.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
AI Assistance
This package is developed with AI assistance, primarily using GitHub Copilot and Claude Sonnet.
AI tools are used for suggestions and development acceleration. All final implementation decisions, code review, and adjustments are made by the maintainers. AI-generated contributions are welcome in pull requests, provided that a person is actively involved in the implementation and review process.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- francoism90
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-pwa with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^12.0||^13.0