Installation
Require the package with Composer. The service provider and the Plausible facade alias are auto-discovered, and the four Roundly companion packages it builds on are installed automatically:
composer require roundly-consulting/plausible-for-laravelAdd your instance URL, API key and — optionally — a default site to .env. The key is for the Stats and Sites APIs; capturing events needs only the URL. That is all the configuration most apps need:
PLAUSIBLE_URL=https://plausible.io
PLAUSIBLE_API_KEY=your-api-key
PLAUSIBLE_SITE=my-site.comThe config file is optional — every key is env-backed. Publish it only to override defaults:
php artisan vendor:publish --tag="plausible-config"To customise the tracking-script markup, publish the view — Plausible::script(), @plausibleScript and <x-plausible-script> all render it:
php artisan vendor:publish --tag="plausible-views"There are no migrations — the package stores nothing in your database.
Verify the connection
Once the env is set, check configuration and connectivity in one command. It fails when the URL or key is missing, the instance is unreachable, or the key is refused — add --site= to verify a Stats API key against that site:
php artisan plausible:healthShow your open-source love
This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.
More ways to support, including cryptoBy donating, you agree to our donation terms.
Want this built into your product?
We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.