### Install Filament Umami via Composer Source: https://github.com/jeffersongoncalves/filament-umami/blob/3.x/README.md Install the package via Composer. Requires PHP 8.2+, Laravel 11.0+, and Filament 5.0. ```bash composer require jeffersongoncalves/filament-umami ``` -------------------------------- ### UmamiPlugin class implementing Filament Plugin interface Source: https://github.com/jeffersongoncalves/filament-umami/blob/3.x/resources/boost/skills/filament-umami-development/SKILL.md Defines the plugin class with get, make, register, boot, and settingsPage methods. The settingsPage method can be used to disable the settings page. ```php namespace JeffersonGoncalves\Filament\Umami; use Filament\Contracts\Plugin; use Filament\Panel; use JeffersonGoncalves\Filament\Umami\Pages\ManageUmamiSettings; class UmamiPlugin implements Plugin { protected bool $hasSettingsPage = true; public function getId(): string { return 'filament-umami'; } public function register(Panel $panel): void { if ($this->hasSettingsPage) { $panel->pages([ ManageUmamiSettings::class, ]); } } public function boot(Panel $panel): void {} public static function make(): static { return app(static::class); } public static function get(): static { $plugin = filament(app(static::class)->getId()); return $plugin; } public function settingsPage(bool $condition = true): static { $this->hasSettingsPage = $condition; return $this; } } ``` -------------------------------- ### Publish and Run Settings Migrations Source: https://github.com/jeffersongoncalves/filament-umami/blob/3.x/README.md Publish the spatie/laravel-settings migration to create the settings table, then publish and run the Umami settings migration. ```bash php artisan vendor:publish --provider="Spatie\LaravelSettings\LaravelSettingsServiceProvider" --tag="migrations" ``` ```bash php artisan vendor:publish --tag=umami-settings-migrations php artisan migrate ``` -------------------------------- ### Run Tests with Composer Source: https://github.com/jeffersongoncalves/filament-umami/blob/3.x/README.md Run the package test suite. ```bash composer test ``` -------------------------------- ### ManageUmamiSettings settings page implementation Source: https://github.com/jeffersongoncalves/filament-umami/blob/3.x/resources/boost/skills/filament-umami-development/SKILL.md Extends Filament's SettingsPage and uses UmamiSettings from the jeffersongoncalves/laravel-umami package. Defines the form schema with sections for tracking configuration, behavior, and advanced options using TextInput, Toggle, and Section components. ```php namespace JeffersonGoncalves\Filament\Umami\Pages; use Filament\Forms\Components\TextInput; use Filament\Forms\Components\Toggle; use Filament\Pages\SettingsPage; use Filament\Schemas\Components\Section; use Filament\Schemas\Schema; use JeffersonGoncalves\Umami\Settings\UmamiSettings; class ManageUmamiSettings extends SettingsPage { protected static string $settings = UmamiSettings::class; protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-chart-bar-square'; public function form(Schema $schema): Schema { return $schema ->columns(null) ->schema([ // Tracking Configuration Section::make(/* ... */) ->schema([ TextInput::make('website_id')->nullable(), TextInput::make('host_analytics')->url()->required(), TextInput::make('host_url')->url()->nullable(), ])->columns(2), // Tracking Behavior Section::make(/* ... */) ->schema([ Toggle::make('auto_track'), Toggle::make('exclude_search'), Toggle::make('exclude_hash'), ])->columns(2), // Advanced Options Section::make(/* ... */) ->schema([ TextInput::make('domains')->nullable(), TextInput::make('tag')->nullable(), ])->columns(2), ]); } } ``` -------------------------------- ### Register UmamiPlugin in PanelProvider Source: https://github.com/jeffersongoncalves/filament-umami/blob/3.x/README.md Register the Umami plugin in your PanelProvider. This automatically injects the tracking script and adds a Settings Page for configuration. ```php use JeffersonGoncalves\Filament\Umami\UmamiPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ UmamiPlugin::make(), ]); } ``` -------------------------------- ### Retrieve UmamiPlugin instance Source: https://github.com/jeffersongoncalves/filament-umami/blob/3.x/resources/boost/skills/filament-umami-development/SKILL.md Retrieves the UmamiPlugin instance from the current Filament panel. Use this to access plugin configuration or methods within your application code. ```php // Get the plugin instance from the current panel $plugin = UmamiPlugin::get(); ``` -------------------------------- ### Disable Umami Settings Page Source: https://github.com/jeffersongoncalves/filament-umami/blob/3.x/README.md Disable the settings page if you only want the tracking script injection without the settings page. ```php UmamiPlugin::make() ->settingsPage(false), ``` -------------------------------- ### UmamiServiceProvider script injection Source: https://github.com/jeffersongoncalves/filament-umami/blob/3.x/resources/boost/skills/filament-umami-development/SKILL.md The service provider registers a render hook to inject the Umami tracking script into the panel head. The view is sourced from the 'jeffersongoncalves/laravel-umami' package as 'umami::script'. ```php namespace JeffersonGoncalves\Filament\Umami; use Filament\Support\Facades\FilamentView; use Filament\View\PanelsRenderHook; use Illuminate\Contracts\View\View; use Spatie\LaravelPackageTools\Package; use Spatie\LaravelPackageTools\PackageServiceProvider; class UmamiServiceProvider extends PackageServiceProvider { public function configurePackage(Package $package): void { $package->name('filament-umami') ->hasTranslations(); } public function packageRegistered(): void { FilamentView::registerRenderHook( PanelsRenderHook::HEAD_START, fn (): View => view('umami::script') ); } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.