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

Without the facade

The facade is the recommended default, not the only way in. It is sugar over RoundlyConsulting\Plausible\PlausibleManager — the facade root, bound as a container singleton. Inject the manager through the constructor for the same API as an explicit dependency with no static calls, or call the plausible() helper, which returns the same instance:

use RoundlyConsulting\Plausible\PlausibleManager;

final class DashboardController
{
    public function __construct(private PlausibleManager $plausible) {}

    public function __invoke()
    {
        return $this->plausible->stats()->for('my-site.com')->last30Days()->aggregate();
    }
}

plausible()->sites()->list();   // the helper returns the same singleton

Resource clients instead of actions

Plausible is a remote API, so there are no action classes: each area is a resource client resolved from the container, which you can also inject or rebind directly:

Facade methodResource clientCovers
stats()Repositories\StatsRepositoryFluent builder, explicit requests, Stats v2 run().
events()Repositories\EventsRepositoryPageviews, custom events, queued and batched capture.
sites()Repositories\SitesRepositorycreate, get, list, update, delete.
goals()Repositories\GoalsRepositorycreate, list, delete.
sharedLinks()Repositories\SharedLinksRepositorycreate, createFrom.

Plausible::fake() replaces the manager behind the facade and in the container, so an injected PlausibleManager and plausible() are recorded too. Go through the manager when you want a call to show up in the fake’s assertions.

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.