---
title: "The Plausible facade — Plausible for Laravel | Roundly"
description: "The Plausible facade: one resource client per API area — stats, events, sites, goals, shared links — plus script, ping and health."
url: https://roundly-consulting.com/open-source/docs/plausible-for-laravel/client
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Plausible for Laravel](https://roundly-consulting.com/open-source/docs/plausible-for-laravel.md)

# The Plausible facade

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

```php
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:

```php
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
```

| Method | Returns | Purpose |
| --- | --- | --- |
| `stats()` | StatsRepository | Realtime, aggregate, timeseries and breakdown reads, plus the Stats v2 query endpoint. |
| `events()` | EventsRepository | Pageviews and custom events, sent synchronously, on the queue or as a batch. |
| `sites()` | SitesRepository | Create, get, list, update and delete sites. |
| `goals()` | GoalsRepository | Create, list and delete conversion goals. |
| `sharedLinks()` | SharedLinksRepository | Find or create shareable dashboard links. |
| `script(?$domain)` | HtmlString | The hosted tracking-script tag — see Tracking script. |
| `ping(?$site)` | bool | Whether Plausible is reachable and accepts the key — optionally verified against a site. |
| `health(?$site)` | HealthResult | Configuration, connectivity and key acceptance, without throwing — see Health check. |
| `fake()` | PlausibleFake | Swap 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](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

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

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/plausible-for-laravel.md)
