Pular para o conteúdo
← Voltar para projetos

Filament Pwa

Filament plugin that injects the PWA <head> markup (manifest link, theme-color meta and Apple touch icons) into your panels.

Versão: v3 v4 v5 · branch: 3.x

Filament PWA

#Filament PWA

Buy Me A Coffee

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads License

A thin Filament plugin that turns your panels into installable Progressive Web Apps. It registers a PanelsRenderHook::HEAD_START render hook that injects the PWA <head> markup into your panels:

  • the web app manifest <link rel="manifest">,
  • the <meta name="theme-color"> tag, and
  • the Apple touch icon <link> tags produced by laravel-pwa-favicon.

This plugin is built on top of the laravel-pwa-favicon package. The favicon/manifest routes (/manifest.json, /browserconfig.xml, /favicon.ico, ...) are registered by that package's service provider — this plugin only injects the matching <head> tags into your Filament panels.

#Compatibility

Branch Filament PHP Laravel
1.x ^3.0 ^8.2 | ^8.3 11.*
2.x ^4.0 ^8.2 | ^8.3 | ^8.4 11.* | 12.*
3.x ^5.0 ^8.3 12.* | 13.*

#Installation

You can install the package via composer:

composer require jeffersongoncalves/filament-pwa:^1.0

The jeffersongoncalves/laravel-pwa-favicon package is installed as a dependency. Follow its README to publish the favicon assets and enable the manifest/favicon routes — without it the manifest link will point at a route that does not exist.

#Usage

Register the plugin in your PanelProvider:

use JeffersonGoncalves\Filament\Pwa\FilamentPwaPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            FilamentPwaPlugin::make(),
        ]);
}

The plugin will inject the manifest link, the theme-color meta tag and the Apple touch icon links into the panel's <head>.

#Customisation

FilamentPwaPlugin::make()
    ->themeColor('#0ea5e9')          // <meta name="theme-color">, defaults to #ffffff
    ->manifestUrl('/manifest.json'), // <link rel="manifest"> href, defaults to /manifest.json

The render hook is scoped to the panel it is registered on, so you can enable the PWA <head> markup per panel.

#Testing

composer test

#Changelog

Please see CHANGELOG for more information on what has changed recently.

#Contributing

Please see CONTRIBUTING for details.

#Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

#Credits

#License

The MIT License (MIT). Please see License File for more information.

Nova versão disponível.