### Install Filament Fathom with Composer Source: https://github.com/jeffersongoncalves/filament-fathom/blob/3.x/README.md Install the Filament Fathom plugin via Composer. Requires PHP 8.2+, Laravel 11.0+, and Filament 5.x. ```bash composer require jeffersongoncalves/filament-fathom:"^3.0" ``` -------------------------------- ### Publish and run Fathom settings migrations Source: https://github.com/jeffersongoncalves/filament-fathom/blob/3.x/README.md Publish and run the Fathom settings migrations. Execute these commands after publishing the spatie/laravel-settings migrations. ```bash php artisan vendor:publish --tag=fathom-settings-migrations php artisan migrate ``` -------------------------------- ### Publish spatie/laravel-settings migrations Source: https://github.com/jeffersongoncalves/filament-fathom/blob/3.x/README.md Publish the spatie/laravel-settings migrations. Run this before publishing the Fathom settings migrations. ```bash php artisan vendor:publish --provider="Spatie\LaravelSettings\LaravelSettingsServiceProvider" --tag="migrations" ``` -------------------------------- ### FathomServiceProvider Configuration Source: https://github.com/jeffersongoncalves/filament-fathom/blob/3.x/resources/boost/skills/filament-fathom-development/SKILL.md The service provider registers the Fathom tracking script into the HEAD_START render hook of the Filament panel. ```php namespace JeffersonGoncalves\Filament\Fathom; use Filament\Support\Facades\FilamentView; use Filament\View\PanelsRenderHook; use Illuminate\Contracts\View\View; use Spatie\LaravelPackageTools\Package; use Spatie\LaravelPackageTools\PackageServiceProvider; class FathomServiceProvider extends PackageServiceProvider { public function configurePackage(Package $package): void { $package ->name('filament-fathom') ->hasTranslations(); } public function packageRegistered(): void { FilamentView::registerRenderHook(PanelsRenderHook::HEAD_START, fn (): View => view('fathom::script')); } } ``` -------------------------------- ### Run Filament Fathom tests Source: https://github.com/jeffersongoncalves/filament-fathom/blob/3.x/README.md Run the package test suite. ```bash composer test ``` -------------------------------- ### FathomPlugin Class Implementation Source: https://github.com/jeffersongoncalves/filament-fathom/blob/3.x/resources/boost/skills/filament-fathom-development/SKILL.md The FathomPlugin class implements the Filament Plugin contract, managing the plugin ID and the registration of the settings page within the panel. ```php namespace JeffersonGoncalves\Filament\Fathom; use Filament\Contracts\Plugin; use Filament\Panel; use JeffersonGoncalves\Filament\Fathom\Pages\FathomSettingsPage; class FathomPlugin implements Plugin { protected bool $hasSettingsPage = true; public static function make(): static { return app(static::class); } public static function get(): static { $plugin = filament(app(static::class)->getId()); return $plugin; } public function getId(): string { return 'filament-fathom'; } public function register(Panel $panel): void { if ($this->hasSettingsPage) { $panel->pages([ FathomSettingsPage::class, ]); } } public function boot(Panel $panel): void {} public function settingsPage(bool $condition = true): static { $this->hasSettingsPage = $condition; return $this; } } ``` -------------------------------- ### Register FathomPlugin in Filament PanelProvider Source: https://github.com/jeffersongoncalves/filament-fathom/blob/3.x/README.md Register the Fathom plugin in your Filament PanelProvider. Add the FathomPlugin::make() call to the plugins array. ```php use JeffersonGoncalves\Filament\Fathom\FathomPlugin; public function panel(Panel $panel): Panel { return $panel // ... ->plugins([ FathomPlugin::make(), ]); } ``` -------------------------------- ### FathomSettingsPage Form Schema Source: https://github.com/jeffersongoncalves/filament-fathom/blob/3.x/resources/boost/skills/filament-fathom-development/SKILL.md The settings page defines the form schema for Fathom configuration, including fields for website ID, canonical tracking, and SPA settings. ```php namespace JeffersonGoncalves\Filament\Fathom\Pages; use Filament\Forms\Components\Select; 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\Fathom\Settings\FathomSettings; class FathomSettingsPage extends SettingsPage { protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-chart-bar'; protected static string $settings = FathomSettings::class; public function form(Schema $schema): Schema { return $schema ->columns(null) ->schema([ Section::make(__('filament-fathom::fathom.section_title')) ->schema([ TextInput::make('website_id') ->label(__('filament-fathom::fathom.fields.website_id.label')) ->helperText(__('filament-fathom::fathom.fields.website_id.helper')) ->placeholder('ABCDEFGH'), Toggle::make('canonical') ->label(__('filament-fathom::fathom.fields.canonical.label')) ->helperText(__('filament-fathom::fathom.fields.canonical.helper')), Toggle::make('auto') ->label(__('filament-fathom::fathom.fields.auto.label')) ->helperText(__('filament-fathom::fathom.fields.auto.helper')), Select::make('spa') ->label(__('filament-fathom::fathom.fields.spa.label')) ->helperText(__('filament-fathom::fathom.fields.spa.helper')) ->options([ 'auto' => 'Auto', 'history' => 'History', 'hash' => 'Hash', ]) ->placeholder(__('filament-fathom::fathom.fields.spa.placeholder')), Toggle::make('honor_dnt') ->label(__('filament-fathom::fathom.fields.honor_dnt.label')) ->helperText(__('filament-fathom::fathom.fields.honor_dnt.helper')), ]), ]); } } ``` -------------------------------- ### Disable Fathom settings page Source: https://github.com/jeffersongoncalves/filament-fathom/blob/3.x/README.md Disable the built-in settings page while keeping automatic script injection. Use this when you only need the tracking script without the admin settings UI. ```php FathomPlugin::make()->settingsPage(false) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.