Download the PHP package edu17/filament-pwa-plugin without Composer
On this page you can find all versions of the php package edu17/filament-pwa-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download edu17/filament-pwa-plugin
More information about edu17/filament-pwa-plugin
Files in edu17/filament-pwa-plugin
Package filament-pwa-plugin
Short Description A Progressive Web App (PWA) plugin for FilamentPHP panels.
License MIT
Homepage https://github.com/edu17/filament-pwa-plugin
Informations about the package filament-pwa-plugin
Filament PWA Plugin
Turn any FilamentPHP 4 panel into an installable Progressive Web App. Each panel receives its own manifest, service-worker scope, offline fallback, icons, and optional database-backed settings page.
Features
- Independent PWA configuration for every Filament panel.
- Installable web app manifest and panel-scoped service worker.
- Safe offline fallback without caching authenticated HTML or Livewire requests.
- Fluent, configuration-file, and database-backed settings.
- Optional settings page hosted on the same panel or a separate administration panel.
- Access through panel authentication, a Laravel Gate, or a custom callback.
- Automatic 192×192, 512×512, maskable, and Apple touch icon generation from one image.
Requirements
- PHP 8.2 or later.
- FilamentPHP 4.
- HTTPS in production. Browsers allow service workers on
localhostduring local development. - GD or Imagick when using automatic icon generation.
- A publicly accessible filesystem disk when uploading icons from the settings page.
Installation
Install the package:
Run the package installer:
The installer publishes the configuration, migration, default icons, and Filament assets. It asks whether it should run the migrations. Answer yes, or run them later with:
Register the plugin on every panel that should become a PWA:
The PWA endpoints are created below the panel path. A panel at /admin receives:
/admin/manifest.webmanifest/admin/pwa-service-worker.js/admin/offline
Manual installation
Instead of the installer, each step can be run manually:
When the settings page uses the default public disk, ensure Laravel's storage link exists:
Installing the development branch
Before a stable release is available on Packagist, the package can be installed directly from GitHub:
Basic configuration
The published config/pwa-plugin.php file defines the defaults shared by all registered panels:
Leave manifest.id, manifest.start_url, and manifest.scope as null to derive them from each panel path. This is the recommended setting for applications with multiple panels.
After changing a cached configuration file, clear Laravel's configuration cache:
Per-panel fluent configuration
Manifest values can be overridden on an individual panel:
Every fluent option accepts a closure that receives the current Panel:
Values saved from the settings page take precedence over fluent values and configuration defaults. Fluent values take precedence over config/pwa-plugin.php. The database overrides apply only while settings.enabled is true.
Settings page
The settings page can edit the application name, short name, description, colors, display mode, orientation, offline text, cache version, and icons independently for every managed panel.
The migration must be executed before setting settings.enabled to true.
Separate administration and PWA panels
For example, to display the settings page in superadmin while managing the PWA installed at admin:
Register the plugin on both panels. It can remain disabled as a PWA on the panel that only hosts the settings page:
One panel
A single panel can host the settings page and be the PWA it manages:
Register FilamentPwaPlugin::make() once in the admin panel provider.
Multiple panels
Both configuration values accept multiple panel IDs:
Every panel in either list must register the plugin. A managed panel can use ->enabled(false) when it should be configurable but should not expose PWA endpoints.
Settings authorization
The authorization method is optional and does not depend on a roles package.
Panel authentication only
Keep settings.ability as null. Any authenticated user who can access the panel containing the settings page can manage the configured PWA panels:
This is appropriate when access is already separated through Filament panels.
Laravel Gate or permission
Set an ability name:
Define the corresponding Gate in the application:
Packages that integrate permissions with Laravel's can() method can use a permission name as the ability.
Custom callback
Authorization can also be defined directly on the plugin instance that hosts the settings page:
The callback receives the authenticated user and the panel that hosts the settings page.
Icons
The installation command publishes default icons to public/vendor/filament-pwa-plugin/icons. They can be replaced manually or configured through the icons and apple_touch_icon options.
The manifest uses:
- A 192×192 PNG icon.
- A 512×512 PNG icon.
- A maskable 512×512 PNG icon.
The Apple 180×180 icon is rendered separately as an apple-touch-icon link in the panel HTML.
The settings page accepts one square image of at least 512×512 pixels and up to 5 MB. It generates all four PNG variants. Generated files are stored on settings.disk under settings.directory/{panel}/icons.
Offline behavior
The service worker is scoped to the exact panel path. A panel at /admin handles /admin and /admin/..., but it does not handle /administrator or the rest of the Laravel application.
The default strategy:
- Precaches the offline fallback and configured PWA icons.
- Uses the network for page navigations.
- Shows the offline fallback when a navigation request fails.
- Runtime-caches same-origin scripts, styles, and fonts.
- Never intercepts non-GET or cross-origin requests.
- Does not runtime-cache authenticated HTML, Livewire responses, API responses, or ordinary uploaded images.
Increment offline.cache_version after changing resources that may already be cached. Additional public same-origin URLs can be added to offline.precache.
Verify the installation
Replace admin with the path of the target panel and verify:
- Open
/admin/manifest.webmanifestand confirm that it returns JSON with the expectedname,start_url,scope, and icons. - Open
/admin/pwa-service-worker.jsand confirm that it returns JavaScript with aService-Worker-Allowed: /adminheader. - Open
/admin/offlineand confirm that the offline page renders. - Open the panel over HTTPS and confirm in the browser developer tools that the service worker is activated and the manifest is installable.
- Test the offline fallback by enabling the browser's offline network mode and navigating within the panel.
Browsers may cache the manifest and installed application metadata. After changing the name, scope, display mode, or icons, increment the cache version, clear the site's application data, and reinstall the PWA when necessary.
Updating
After updating the package, publish new migrations and assets, run migrations, and refresh Filament's assets:
Do not use --force when publishing the configuration unless replacing local configuration changes is intentional.
Testing
Changelog
Please see CHANGELOG for information about recent changes.
Contributing
Please see CONTRIBUTING for details.
Security vulnerabilities
Please review our security policy to report security vulnerabilities.
Credits
- Eduardo Ismalej
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of filament-pwa-plugin with dependencies
filament/filament Version ^4.0
intervention/image Version ^3.0
spatie/laravel-package-tools Version ^1.15.0