Plausible Analytics API client for Laravel
roundly-consulting/plausible-for-laravel is a Laravel package for plausible analytics api client for laravel.
It currently has 0 GitHub stars and 6 downloads on Packagist (latest version 1.1.1).
Install it with composer require roundly-consulting/plausible-for-laravel.
Discover more Laravel packages by roundly-consulting
or browse all Laravel packages to compare alternatives.
Last updated
A clean, expressive client for the Plausible Analytics API. Query your stats, capture custom events server-side, and manage sites from your Laravel application through a fluent, strongly-typed API — no manual HTTP plumbing required.
Requires PHP 8.4 (ext-bcmath), Laravel 12 or 13, and a Plausible account (Cloud or self-hosted).
composer require roundly-consulting/plausible-for-laravel
Set PLAUSIBLE_URL (your Plausible instance, e.g. https://plausible.io), PLAUSIBLE_API_KEY
(a Stats API key — event capture needs none) and PLAUSIBLE_SITE (the default site) in .env.
Read typed stats with the fluent builder:
use RoundlyConsulting\Plausible\Enums\Metric;
use RoundlyConsulting\Plausible\Enums\Property;
use RoundlyConsulting\Plausible\Facades\Plausible;
$result = Plausible::stats()
->for('my-site.com')
->metrics(Metric::Visitors, Metric::Pageviews)
->last30Days()
->compare()
->aggregate(); // -> AggregateResult
$result->metric(Metric::Visitors); // 2001
$result->change(Metric::Visitors); // 30 — the change vs the previous 30 days
$sources = Plausible::stats()->for('my-site.com')->last7Days()
->breakdown(Property::VisitSource)
->rows(); // list<BreakdownRow>
Capture a conversion server-side — the visitor comes from the request, the site from
PLAUSIBLE_SITE:
use RoundlyConsulting\Plausible\DataTransferObjects\Revenue;
Plausible::events()->fromRequest(request())->event(
'Signup',
url: url('/register'),
props: ['plan' => 'pro'],
revenue: Revenue::of('49.00', 'EUR'),
);
The full documentation — configuration, every feature and its API, and testing — lives on our website: roundly-consulting.com/open-source/docs/plausible-for-laravel
Release notes are in CHANGELOG.md. To contribute, see the contributing guide.
This package is free and open source, built and maintained by Roundly Consulting. If it saves you time, please consider supporting our open-source work — a one-time donation, a monthly pledge on Patreon or a crypto donation helps fund maintenance, new features and new packages.
The MIT License (MIT). Please see License File for more information.