NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages
Plausible for Laravel

The Plausible facade

Use the Plausible facade — it is registered automatically and is the recommended entry point:

use RoundlyConsulting\Plausible\Facades\Plausible;

Plausible::stats()->for('my-site.com')->last7Days()->aggregate();
Plausible::stats()->query()->last7Days()->aggregate();   // query() = the PLAUSIBLE_SITE default
Plausible::events()->fromRequest(request())->event('Signup', url: url('/register'));
Plausible::script();   // the <script> tag, for any view

The whole surface

The facade exposes one resource client per API area, plus the tracking-script tag and two health helpers:

use RoundlyConsulting\Plausible\Facades\Plausible;

// One resource client per API area
Plausible::stats();        // StatsRepository — the query API
Plausible::events();       // EventsRepository — event ingestion
Plausible::sites();        // SitesRepository — site provisioning
Plausible::goals();        // GoalsRepository — goal provisioning
Plausible::sharedLinks();  // SharedLinksRepository — shared dashboard links

// Plus three helpers
Plausible::script('my-site.com');   // HtmlString — the tracking-script tag
Plausible::ping();                  // bool — reachable AND the key is accepted
Plausible::health('my-site.com');   // HealthResult — configuration and connectivity, never throws
MethodReturnsPurpose
stats()StatsRepositoryRealtime, aggregate, timeseries and breakdown reads, plus the Stats v2 query endpoint.
events()EventsRepositoryPageviews and custom events, sent synchronously, on the queue or as a batch.
sites()SitesRepositoryCreate, get, list, update and delete sites.
goals()GoalsRepositoryCreate, list and delete conversion goals.
sharedLinks()SharedLinksRepositoryFind or create shareable dashboard links.
script(?$domain)HtmlStringThe hosted tracking-script tag — see Tracking script.
ping(?$site)boolWhether Plausible is reachable and accepts the key — optionally verified against a site.
health(?$site)HealthResultConfiguration, connectivity and key acceptance, without throwing — see Health check.
fake()PlausibleFakeSwap in the recording fake — see Testing.

Stats and Sites requests go to your configured url with the API key as a Bearer token; event captures go to the unauthenticated Events API and never carry the key. Every request uses the configured timeout and the optional retry.* retries, and passes through the rate limiter of its surface.

Show 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 crypto

By 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.