Search by

roundly-consulting / plausible-for-laravel

mihaliak

Plausible Analytics API client for Laravel

Package info

github.com/roundly-consulting/plausible-for-laravel

pkg:composer/roundly-consulting/plausible-for-laravel

Fund package maintenance!

Patreon

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-10-03 18:14 UTC

This package is auto-updated.

Last update: 2026-10-03 18:35:45 UTC


README

Plausible for Laravel — Roundly open source

Latest release Tests Code style Donate Patreon Crypto

Plausible for Laravel

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.

Installation

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.

Usage

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'),
);

Documentation

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.

Support our work

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.

Donate to Roundly open source Become a patron on Patreon Donate crypto: BTC, ETH, BNB or SOL

License

The MIT License (MIT). Please see License File for more information.