### Install Filament Plausible via Composer Source: https://github.com/jeffersongoncalves/filament-plausible/blob/3.x/README.md Install the package via Composer. Requires PHP 8.2+, Laravel 11.28+, and Filament 5.x. ```bash composer require jeffersongoncalves/filament-plausible:"^3.0" ``` -------------------------------- ### Publish and Run Plausible Settings Migration Source: https://github.com/jeffersongoncalves/filament-plausible/blob/3.x/README.md Publish and run the Plausible settings migration. ```bash php artisan vendor:publish --tag=plausible-settings-migrations php artisan migrate ``` -------------------------------- ### Publish settings migrations Source: https://github.com/jeffersongoncalves/filament-plausible/blob/3.x/resources/boost/skills/filament-plausible-development/SKILL.md Run these artisan commands to publish and run the required migrations for the settings plugin and the Plausible settings. ```bash php artisan vendor:publish --provider="Spatie\LaravelSettings\LaravelSettingsServiceProvider" --tag="migrations" php artisan vendor:publish --tag=plausible-settings-migrations php artisan migrate ``` -------------------------------- ### Publish and Run Spatie Settings Migration Source: https://github.com/jeffersongoncalves/filament-plausible/blob/3.x/README.md Publish and run the settings migration from spatie/laravel-settings if not already done. ```bash php artisan vendor:publish --provider="Spatie\LaravelSettings\LaravelSettingsServiceProvider" --tag="migrations" php artisan migrate ``` -------------------------------- ### ManagePlausibleSettings Page Class Source: https://github.com/jeffersongoncalves/filament-plausible/blob/3.x/resources/boost/skills/filament-plausible-development/SKILL.md Defines the settings page for managing Plausible configuration within Filament. ```php namespace JeffersonGoncalves\Filament\Plausible\Pages; use Filament\Pages\SettingsPage; use JeffersonGoncalves\Plausible\Settings\PlausibleSettings; class ManagePlausibleSettings extends SettingsPage { protected static string $settings = PlausibleSettings::class; protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-chart-bar'; } ``` -------------------------------- ### PlausibleServiceProvider Class Definition Source: https://github.com/jeffersongoncalves/filament-plausible/blob/3.x/resources/boost/skills/filament-plausible-development/SKILL.md Handles service registration and script injection via render hooks. ```php namespace JeffersonGoncalves\Filament\Plausible; use Spatie\LaravelPackageTools\PackageServiceProvider; class PlausibleServiceProvider extends PackageServiceProvider { // Registers the render hook for script injection // FilamentView::registerRenderHook(PanelsRenderHook::HEAD_START, fn (): View => view('plausible::script')); } ``` -------------------------------- ### Register PlausiblePlugin in PanelProvider Source: https://github.com/jeffersongoncalves/filament-plausible/blob/3.x/README.md Register the plugin in your PanelProvider to enable automatic script injection and the settings page. ```php use JeffersonGoncalves\Filament\Plausible\PlausiblePlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ PlausiblePlugin::make(), ]); } ``` -------------------------------- ### Disable Settings Page with settingsPage(false) Source: https://github.com/jeffersongoncalves/filament-plausible/blob/3.x/README.md Disable the settings page if you only want automatic script injection without the admin UI. ```php PlausiblePlugin::make() ->settingsPage(false), ``` -------------------------------- ### Track Custom Plausible Event in Blade Source: https://github.com/jeffersongoncalves/filament-plausible/blob/3.x/resources/boost/skills/filament-plausible-development/SKILL.md Use this script in Blade views to track custom events with Plausible. The plugin handles base script injection, so only the event call is needed. ```html ``` -------------------------------- ### Override Filament Plausible Settings Page Source: https://github.com/jeffersongoncalves/filament-plausible/blob/3.x/resources/boost/skills/filament-plausible-development/SKILL.md Override the default settings page by extending the base ManagePlausibleSettings class and customizing the form schema. After creating this class, disable the default settings page and register this custom page in the panel provider. ```php namespace App\Filament\Pages; use JeffersonGoncalves\Filament\Plausible\Pages\ManagePlausibleSettings as BaseSettings; class ManagePlausibleSettings extends BaseSettings { public function form(Schema $schema): Schema { return $schema ->columns(null) ->schema([ // Your custom schema here ]); } } ``` -------------------------------- ### PlausiblePlugin Class Definition Source: https://github.com/jeffersongoncalves/filament-plausible/blob/3.x/resources/boost/skills/filament-plausible-development/SKILL.md Defines the main plugin class implementing the Filament Plugin contract. ```php namespace JeffersonGoncalves\Filament\Plausible; use Filament\Contracts\Plugin; use Filament\Panel; class PlausiblePlugin implements Plugin { protected bool $hasSettingsPage = true; public static function make(): static; public static function get(): static; public function getId(): string; // returns 'filament-plausible' public function register(Panel $panel): void; public function boot(Panel $panel): void; public function settingsPage(bool $condition = true): static; } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.