jeffersongoncalves/laravel-plausible

A lightweight Laravel package that seamlessly integrates Plausible Analytics into your Blade views. Plausible.io is a privacy-friendly, open-source alternative to Google Analytics.

Installs: 21

Dependents: 1

Suggesters: 0

Security: 0

Stars: 2

Watchers: 1

Forks: 0

pkg:composer/jeffersongoncalves/laravel-plausible

v2.0.1 2026-02-24 17:21 UTC

This package is auto-updated.

Last update: 2026-02-24 17:26:02 UTC


README

Laravel Plausible

Laravel Plausible

Latest Version on Packagist GitHub Code Style Action Status Total Downloads

A lightweight Laravel package that seamlessly integrates Plausible Analytics into your Blade views. Plausible.io is a privacy-friendly, open-source alternative to Google Analytics.

Settings are stored in the database using spatie/laravel-settings, making it easy to manage from an admin panel or programmatically.

Installation

Install the package via Composer:

composer require jeffersongoncalves/laravel-plausible

Publish and run the settings table migration from spatie/laravel-settings (if not already done):

php artisan vendor:publish --provider="Spatie\LaravelSettings\LaravelSettingsServiceProvider" --tag="migrations"
php artisan migrate

Publish and run the Plausible settings migration:

php artisan vendor:publish --tag=plausible-settings-migrations
php artisan migrate

Usage

Include the script in your layout

Add the following to your Blade layout (inside <head>):

@include('plausible::script')

The script tag will only be rendered when the domains setting is configured.

Configure settings

You can update the settings programmatically:

use JeffersonGoncalves\Plausible\Settings\PlausibleSettings;

$settings = app(PlausibleSettings::class);
$settings->domains = 'example.com';
$settings->save();

Available settings

Setting Type Default Description
domains ?string null Domain(s) to track. Supports rollup reporting with comma-separated domains.
host_analytics string https://plausible.io Plausible host URL. Change this if you are self-hosting Plausible.

Self-hosted Plausible

If you are self-hosting Plausible, update the host_analytics setting:

$settings = app(PlausibleSettings::class);
$settings->host_analytics = 'https://analytics.example.com';
$settings->save();

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.