This comprehensive guide covers all configuration options available in the Filament PWA plugin for both Filament v3 and v4, including the new internationalization features and advanced configuration patterns.
The Filament PWA plugin fully supports both Filament v3 and v4 with the same API and configuration methods.
| Component | v3 Support | v4 Support |
|---|---|---|
| PHP | 8.1+ | 8.2+ |
| Laravel | 10.0+ | 11.28+ |
| Filament | 3.0+ | 4.0+ |
✅ All configuration methods work identically in both versions
✅ Render hooks (HEAD_START, BODY_END) are unchanged
✅ Plugin registration process is identical
✅ Theme color detection works with both versions
✅ All fluent API methods are compatible
✅ Service worker integration remains the same
✅ Icon generation works identically
# Same installation process for both versions
composer require alareqi/filament-pwa
# Plugin registration is identical
FilamentPwaPlugin::make()
->name('My Admin Panel')
->themeColor('#3B82F6')
// ... all other methods work the same
No changes are required in your PWA configuration when upgrading from Filament v3 to v4. The plugin automatically detects the Filament version and adapts accordingly.
// This configuration works in both Filament v3 and v4
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
FilamentPwaPlugin::make()
->name('My Admin Panel')
->themeColor('#3B82F6')
->enableInstallation()
->addShortcut('Dashboard', '/admin'),
]);
}
The plugin supports multiple configuration approaches with different priorities:
The plugin merges configuration from multiple sources in this order (highest to lowest priority):
config/filament-pwa.php.env fileConfigure the basic information about your PWA:
FilamentPwaPlugin::make()
->name('My Admin Panel') // Full app name
->shortName('Admin') // Short name for home screen
->description('Powerful admin panel for managing your application')
->startUrl('/admin') // URL when app opens
Control how your PWA appears when installed:
FilamentPwaPlugin::make()
->displayMode('standalone') // Display mode
->orientation('portrait') // Screen orientation
->scope('/admin') // Navigation scope
// Convenience methods
->standalone() // Same as displayMode('standalone')
->fullscreen() // Same as displayMode('fullscreen')
->portrait() // Same as orientation('portrait')
->landscape() // Same as orientation('landscape')
Available Display Modes:
standalone - Looks like a native app (recommended)fullscreen - Full screen without browser UIminimal-ui - Minimal browser UIbrowser - Regular browser tabAvailable Orientations:
portrait - Portrait orientation preferredlandscape - Landscape orientation preferredportrait-primary - Primary portrait orientationlandscape-primary - Primary landscape orientationany - Any orientation allowedCustomize the visual appearance:
FilamentPwaPlugin::make()
->themeColor('#3B82F6') // Browser UI color
->backgroundColor('#ffffff') // Loading screen background
Use closures for runtime configuration based on user preferences or environment:
FilamentPwaPlugin::make()
// User-specific configuration
->name(fn() => auth()->user()?->company_name ?? 'Admin Panel')
->themeColor(fn() => auth()->user()?->theme_color ?? '#3B82F6')
->language(fn() => auth()->user()?->language ?? app()->getLocale())
->direction(fn() => auth()->user()?->text_direction ?? 'ltr')
// Environment-based configuration
->name(fn() => app()->environment('production') ? 'Production Admin' : 'Dev Admin')
->themeColor(fn() => app()->environment('production') ? '#dc2626' : '#3B82F6')
// Complex dynamic shortcuts
->addShortcut(fn() => [
'name' => 'My Dashboard',
'url' => '/admin/dashboard/' . auth()->id(),
'description' => 'Personal dashboard for ' . auth()->user()?->name,
'icons' => [
[
'src' => auth()->user()?->avatar_url ?? '/images/default-avatar.png',
'sizes' => '96x96',
],
],
])
Control when and how installation prompts appear:
FilamentPwaPlugin::make()
->enableInstallation(2000) // Show prompt after 2 seconds
->disableInstallation() // Disable prompts entirely
// Full installation configuration
->installation(
enabled: true, // Enable installation prompts
promptDelay: 2000, // Delay before showing prompt (ms)
iosInstructionsDelay: 5000, // Delay for iOS instructions (ms)
showBannerInDebug: true // Always show in debug mode
)
// Debug mode helpers
->enableDebugBanner() // Always show banner in debug
->disableDebugBanner() // Disable debug banner
Configure caching strategies and offline behavior:
FilamentPwaPlugin::make()
->serviceWorker(
cacheName: 'my-app-v1.0.0', // Cache name for versioning
offlineUrl: '/offline', // Offline fallback page
cacheUrls: [ // URLs to cache immediately
'/admin',
'/admin/login',
'/admin/dashboard',
'/manifest.json'
]
)
Configure icon generation and paths:
FilamentPwaPlugin::make()
->icons(
path: 'images/icons', // Output directory
sizes: [72, 96, 128, 144, 152, 192, 384, 512], // Standard sizes
maskableSizes: [192, 512] // Maskable icon sizes
)
Add shortcuts that appear when users long-press your app icon:
FilamentPwaPlugin::make()
->addShortcut('Dashboard', '/admin', 'Main dashboard')
->addShortcut('Users', '/admin/users', 'Manage users')
->addShortcut('Settings', '/admin/settings', 'App settings')
// With custom icons
->addShortcut(
name: 'Reports',
url: '/admin/reports',
description: 'View reports',
icons: [
[
'src' => '/images/icons/reports-icon.png',
'sizes' => '96x96',
],
]
)
// Dynamic shortcuts with closures
->addShortcut(fn() => [
'name' => 'My Profile',
'url' => '/admin/profile/' . auth()->id(),
'description' => 'View my profile',
])
Define app categories for app stores:
FilamentPwaPlugin::make()
->categories(['productivity', 'business', 'utilities'])
Common categories: productivity, business, utilities, lifestyle, social, entertainment, education, health, finance, travel
The plugin includes comprehensive internationalization support with built-in translations for 10+ languages.
The plugin automatically detects language and text direction:
FilamentPwaPlugin::make()
// Language and direction are auto-detected from Laravel's locale
// No additional configuration needed
Override automatic detection:
FilamentPwaPlugin::make()
->language('ar') // Set specific language
->direction('rtl') // Set text direction
// Convenience methods
->ltr() // Set left-to-right
->rtl() // Set right-to-left
Configure language based on user preferences:
FilamentPwaPlugin::make()
->language(fn() => auth()->user()?->language ?? app()->getLocale())
->direction(fn() => auth()->user()?->text_direction ?? 'ltr')
| Language | Code | Direction | Status |
|---|---|---|---|
| English | en |
LTR | ✅ Complete |
| Arabic | ar |
RTL | ✅ Complete |
| Spanish | es |
LTR | ✅ Complete |
| French | fr |
LTR | ✅ Complete |
| German | de |
LTR | ✅ Complete |
| Portuguese | pt |
LTR | ✅ Complete |
| Italian | it |
LTR | ✅ Complete |
| Russian | ru |
LTR | ✅ Complete |
| Japanese | ja |
LTR | ✅ Complete |
| Chinese (Simplified) | zh-CN |
LTR | ✅ Complete |
| Dutch | nl |
LTR | ✅ Complete |
For RTL languages, the plugin automatically:
dir="rtl" in the PWA manifest// Automatic RTL detection for Arabic
app()->setLocale('ar');
FilamentPwaPlugin::make()
// Automatically detects Arabic and sets RTL direction
To customize translations:
Publish language files:
php artisan vendor:publish --tag="filament-pwa-lang"
Modify translations in resources/lang/{locale}/pwa.php:
// resources/lang/ar/pwa.php
return [
'install_title' => 'تثبيت التطبيق',
'install_description' => 'احصل على تجربة أفضل مع التطبيق المثبت',
// ... more translations
];
The plugin uses the following translation keys:
// Installation prompts
'install_title', 'install_description', 'install_button', 'dismiss_button'
// iOS installation
'ios_install_title', 'ios_install_description', 'ios_step_1', 'ios_step_2', 'ios_step_3', 'got_it'
// Updates
'update_available', 'update_description', 'update_now', 'update_later'
// Offline functionality
'offline_title', 'offline_subtitle', 'offline_status', 'online_status'
// Features and actions
'available_features', 'retry_connection', 'go_home'
// Validation messages
'validation.manifest_missing', 'validation.service_worker_missing'
// Setup command messages
'setup.starting', 'setup.completed', 'setup.validation_passed'
When using the configuration file approach, all options are available in config/filament-pwa.php:
return [
// 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 Configuration
'theme_color' => env('PWA_THEME_COLOR', null), // Auto-detected from Filament
'background_color' => env('PWA_BACKGROUND_COLOR', '#ffffff'),
// Localization
'lang' => env('PWA_LANG', null), // Auto-detected from Laravel
'dir' => env('PWA_DIR', null), // Auto-detected from language
// Categories
'categories' => [
'productivity',
'business',
'utilities',
],
// Installation Configuration
'installation' => [
'enabled' => env('PWA_INSTALLATION_ENABLED', true),
'prompt_delay' => env('PWA_INSTALLATION_DELAY', 2000),
'ios_instructions_delay' => env('PWA_IOS_INSTRUCTIONS_DELAY', 5000),
'show_banner_in_debug' => env('PWA_SHOW_BANNER_IN_DEBUG', true),
],
// Icon Configuration
'icons' => [
'path' => env('PWA_ICONS_PATH', 'images/icons'),
'sizes' => [72, 96, 128, 144, 152, 192, 384, 512],
'maskable_sizes' => [192, 512],
],
// Service Worker Configuration
'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)$/',
],
],
// App 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' => [],
];
You can override any configuration option using environment variables in your .env file:
# App Information
PWA_APP_NAME="My Custom Admin"
PWA_SHORT_NAME="MyAdmin"
PWA_DESCRIPTION="Custom admin panel"
# Display Settings
PWA_START_URL="/admin"
PWA_DISPLAY="standalone"
PWA_ORIENTATION="portrait-primary"
PWA_SCOPE="/admin"
# Theme
PWA_THEME_COLOR="#3B82F6"
PWA_BACKGROUND_COLOR="#ffffff"
# Localization
PWA_LANG="en"
PWA_DIR="ltr"
# Installation
PWA_INSTALLATION_ENABLED=true
PWA_INSTALLATION_DELAY=2000
PWA_IOS_INSTRUCTIONS_DELAY=5000
PWA_SHOW_BANNER_IN_DEBUG=true
# Icons
PWA_ICONS_PATH="images/icons"
# Service Worker
PWA_CACHE_NAME="my-app-v1.0.0"
PWA_OFFLINE_URL="/offline"
# Advanced
PWA_PREFER_NATIVE_APP=false
The plugin automatically detects several configuration values:
#6366f1)app()->getLocale()'en''rtl' for RTL languages (Arabic, Hebrew, Persian, etc.)'ltr'config('app.name') with " Admin" suffix'Laravel Admin'Use the validation command to check your configuration:
php artisan filament-pwa:setup --validate
This validates:
Get detailed debug information about color detection and configuration:
use Alareqi\FilamentPwa\Services\PwaService;
// In a controller or command
$debug = PwaService::debugColorDetection();
dd($debug);
FilamentPwaPlugin::make()
->name(fn() => Filament::getTenant()?->name . ' Admin' ?? 'Admin Panel')
->themeColor(fn() => Filament::getTenant()?->primary_color ?? '#3B82F6')
->addShortcut(fn() => [
'name' => 'Tenant Dashboard',
'url' => '/admin/' . Filament::getTenant()?->slug,
'description' => 'Go to tenant dashboard',
])
FilamentPwaPlugin::make()
->name(fn() => match(app()->environment()) {
'production' => 'Production Admin',
'staging' => 'Staging Admin',
default => 'Development Admin'
})
->themeColor(fn() => match(app()->environment()) {
'production' => '#dc2626', // Red for production
'staging' => '#f59e0b', // Yellow for staging
default => '#3B82F6' // Blue for development
})
->enableDebugBanner(app()->environment('local'))
FilamentPwaPlugin::make()
->language(fn() => auth()->user()?->language ?? app()->getLocale())
->direction(fn() => auth()->user()?->text_direction ?? 'ltr')
->themeColor(fn() => auth()->user()?->theme_color ?? '#3B82F6')
->addShortcut(fn() => [
'name' => 'My Profile',
'url' => '/admin/profile',
'description' => 'View my profile',
'icons' => [
[
'src' => auth()->user()?->avatar_url ?? '/images/default-avatar.png',
'sizes' => '96x96',
],
],
])
How can I help you explore Laravel packages today?