1. Go to this page and download the library: Download alareqi/filament-pwa library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
alareqi / filament-pwa example snippets
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 for managing your application')
->themeColor('#3B82F6')
->backgroundColor('#ffffff')
->standalone()
->language('en')
->ltr()
->enableInstallation(2000) // Show prompt after 2 seconds
->addShortcut('Dashboard', '/admin', 'Main dashboard')
->addShortcut('Users', '/admin/users', 'Manage users')
->icons('images/icons', [72, 96, 128, 144, 152, 192, 384, 512])
->serviceWorker('my-app-v1.0.0', '/offline'),
]);
}
use Alareqi\FilamentPwa\FilamentPwaPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
FilamentPwaPlugin::make(),
]);
}
// The plugin will automatically use Laravel's app locale
// and detect RTL languages (Arabic, Hebrew, Persian, etc.)
FilamentPwaPlugin::make()
// Language and direction are auto-detected
FilamentPwaPlugin::make()
->language('ar') // Set specific language
->rtl() // Set RTL direction
// Or use LTR
->language('en')
->ltr()
// Automatic RTL detection for Arabic
app()->setLocale('ar');
FilamentPwaPlugin::make()
// Automatically detects Arabic and sets RTL direction
// resources/lang/ar/pwa.php
return [
'install_title' => 'تثبيت التطبيق',
'install_description' => 'احصل على تجربة أفضل مع التطبيق المثبت',
// ... more translations
];
// In config/filament-pwa.php
'theme_color' => '#FF6B35', // Your custom color
// Or via environment
PWA_THEME_COLOR=#FF6B35
// Or via plugin configuration
FilamentPwaPlugin::make()->themeColor('#FF6B35')
// Enable debug mode to always show prompts
FilamentPwaPlugin::make()->enableDebugBanner()
// Check browser console for errors
// Ensure HTTPS is enabled in production
// Update cache name to force refresh
'service_worker' => [
'cache_name' => 'my-app-v1.0.1', // Increment version
],
use Alareqi\FilamentPwa\Services\PwaService;
// In a controller or command
$debug = PwaService::debugColorDetection();
dd($debug);
->name(string|Closure $name) // Set app name
->shortName(string|Closure $shortName) // Set short name
->description(string|Closure $description) // Set description
->startUrl(string|Closure $startUrl) // Set start URL
->themeColor(string|Closure $themeColor) // Set theme color
->backgroundColor(string|Closure $backgroundColor) // Set background color
->displayMode(string $mode) // Set display mode
->standalone() // Set standalone mode
->fullscreen() // Set fullscreen mode
->orientation(string $orientation) // Set orientation
->portrait() // Set portrait orientation
->landscape() // Set landscape orientation
->scope(string $scope) // Set navigation scope
->language(string|Closure $language) // Set language
->direction(string|Closure $direction) // Set text direction
->ltr() // Set left-to-right
->rtl() // Set right-to-left