This guide helps you migrate from the old Filament PWA configuration structure to the new simplified and enhanced configuration system.
The new configuration is more organized and removes unused options:
Old Structure:
return [
'app_name' => 'My App',
'installation_prompts' => [
'enabled' => true,
'delay' => 2000,
'ios_instructions_delay' => 5000,
],
'icons' => [
'source_path' => 'icon.svg', // ❌ Removed (unused)
'output_path' => 'images/icons',
'additional_sizes' => [16, 32], // ❌ Removed (unused)
],
'route_middleware' => ['web'], // ❌ Simplified
];
New Structure:
return [
'name' => 'My App', // ✅ Renamed from 'app_name'
'installation' => [ // ✅ Renamed from 'installation_prompts'
'enabled' => true,
'prompt_delay' => 2000, // ✅ Renamed from 'delay'
'ios_instructions_delay' => 5000,
],
'icons' => [
'path' => 'images/icons', // ✅ Renamed from 'output_path'
'sizes' => [72, 96, 128, 144, 152, 192, 384, 512],
'maskable_sizes' => [192, 512],
],
];
The plugin now provides a comprehensive fluent API for programmatic configuration:
// New fluent API approach
FilamentPwaPlugin::make()
->name('My App')
->themeColor('#3B82F6')
->standalone()
->language('en')
->ltr()
->enableInstallation()
Before migrating, backup your current config/filament-pwa.php file:
cp config/filament-pwa.php config/filament-pwa.php.backup
Update the following keys in your configuration file:
| Old Key | New Key | Notes |
|---|---|---|
app_name |
name |
Backward compatible |
installation_prompts |
installation |
Backward compatible |
installation_prompts.delay |
installation.prompt_delay |
Backward compatible |
icons.output_path |
icons.path |
Backward compatible |
icons.source_path |
❌ Removed | Was unused |
icons.additional_sizes |
❌ Removed | Was unused |
route_middleware |
❌ Simplified | Now handled internally |
Remove these unused configuration options:
// ❌ Remove these (they were never used)
'icons' => [
'source_path' => 'icon.svg', // Remove
'additional_sizes' => [16, 32], // Remove
],
'route_middleware' => ['web'], // Remove
'screenshots' => [], // Remove if empty
'related_applications' => [], // Remove if empty
Update your config/filament-pwa.php to use the new structure:
<?php
return [
// Basic app information
'name' => env('PWA_APP_NAME', config('app.name', 'Laravel') . ' Admin'),
'short_name' => env('PWA_SHORT_NAME', 'Admin'),
'description' => env('PWA_DESCRIPTION', 'Admin panel for ' . config('app.name', 'Laravel')),
// Display settings
'start_url' => env('PWA_START_URL', '/admin'),
'display' => env('PWA_DISPLAY', 'standalone'),
'orientation' => env('PWA_ORIENTATION', 'portrait-primary'),
'scope' => env('PWA_SCOPE', '/admin'),
// Theme
'theme_color' => env('PWA_THEME_COLOR', '#A77B56'),
'background_color' => env('PWA_BACKGROUND_COLOR', '#ffffff'),
// Localization
'lang' => env('PWA_LANG', 'en'),
'dir' => env('PWA_DIR', 'ltr'),
// Categories
'categories' => [
'productivity',
'business',
'utilities',
],
// Installation
'installation' => [
'enabled' => env('PWA_INSTALLATION_ENABLED', true),
'prompt_delay' => env('PWA_INSTALLATION_DELAY', 2000),
'ios_instructions_delay' => env('PWA_IOS_INSTRUCTIONS_DELAY', 5000),
],
// Icons
'icons' => [
'path' => env('PWA_ICONS_PATH', 'images/icons'),
'sizes' => [72, 96, 128, 144, 152, 192, 384, 512],
'maskable_sizes' => [192, 512],
],
// Service worker
'service_worker' => [
'cache_name' => env('PWA_CACHE_NAME', 'filament-admin-v1.0.0'),
'offline_url' => env('PWA_OFFLINE_URL', '/offline'),
'cache_urls' => [
'/admin',
'/admin/login',
'/manifest.json',
],
'cache_patterns' => [
'filament_assets' => '/\/css\/filament\/|\/js\/filament\//',
'images' => '/\.(png|jpg|jpeg|svg|gif|webp|ico)$/',
'fonts' => '/\.(woff|woff2|ttf|eot)$/',
],
],
// Shortcuts
'shortcuts' => [
[
'name' => 'Dashboard',
'short_name' => 'Dashboard',
'description' => 'Go to the main dashboard',
'url' => '/admin',
'icons' => [
[
'src' => '/images/icons/icon-96x96.png',
'sizes' => '96x96',
],
],
],
],
// Advanced options
'prefer_related_applications' => env('PWA_PREFER_NATIVE_APP', false),
'screenshots' => [],
'related_applications' => [],
];
Remove most configuration from the file and use the fluent API in your panel provider:
// Minimal config/filament-pwa.php
<?php
return [
// Keep only environment-specific or complex configurations here
'service_worker' => [
'cache_patterns' => [
'filament_assets' => '/\/css\/filament\/|\/js\/filament\//',
'images' => '/\.(png|jpg|jpeg|svg|gif|webp|ico)$/',
'fonts' => '/\.(woff|woff2|ttf|eot)$/',
],
],
];
// app/Providers/Filament/AdminPanelProvider.php
use Alareqi\FilamentPwa\FilamentPwaPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
FilamentPwaPlugin::make()
->name('My Admin Panel')
->shortName('Admin')
->description('Powerful admin panel')
->themeColor('#3B82F6')
->backgroundColor('#ffffff')
->standalone()
->portrait()
->english()
->enableInstallation(2000)
->addShortcut('Dashboard', '/admin')
->addShortcut('Users', '/admin/users')
->serviceWorker('my-app-v1.0.0'),
]);
}
The new system maintains full backward compatibility:
After migrating, test your configuration:
Validate configuration:
php artisan filament-pwa:setup --validate
Check manifest generation:
curl http://your-app.test/manifest.json
Test installation prompts:
Verify RTL/LTR support:
dir settingsProblem: Installation prompts stopped working after migration.
Solution: Check the new installation configuration structure:
// Old (still works)
'installation_prompts' => [
'enabled' => true,
'delay' => 2000,
]
// New (recommended)
'installation' => [
'enabled' => true,
'prompt_delay' => 2000,
]
Problem: Icons are not loading after migration.
Solution: Update the icon path configuration:
// Old (still works)
'icons' => [
'output_path' => 'images/icons',
]
// New (recommended)
'icons' => [
'path' => 'images/icons',
]
Problem: Service worker not updating after migration.
Solution: Update the cache name to force cache refresh:
'service_worker' => [
'cache_name' => 'filament-admin-v2.0.0', // Increment version
]
If you encounter issues during migration:
php artisan filament-pwa:setup --validateHow can I help you explore Laravel packages today?