---
title: "Explicit request objects — Plausible for Laravel | Roundly"
description: "Build AggregateRequest, TimeseriesRequest and BreakdownRequest yourself and get the raw Response or a typed result."
url: https://roundly-consulting.com/open-source/docs/plausible-for-laravel/explicit-requests
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)

# Explicit request objects

The request objects remain available for power users. The repository methods return the raw Illuminate\\Http\\Client\\Response, and the \*Result variants — aggregateResult(), timeseriesResult(), breakdownResult() — return the typed object:

```php
use RoundlyConsulting\Plausible\Enums\Interval;
use RoundlyConsulting\Plausible\Enums\Metric;
use RoundlyConsulting\Plausible\Enums\Period;
use RoundlyConsulting\Plausible\Enums\Property;
use RoundlyConsulting\Plausible\Requests\Stats\AggregateRequest;
use RoundlyConsulting\Plausible\Requests\Stats\BreakdownRequest;
use RoundlyConsulting\Plausible\Requests\Stats\TimeseriesRequest;

$response = Plausible::stats()->aggregate(AggregateRequest::make(
    site: 'my-site.com',
    metrics: ['visitors', 'pageviews', 'bounce_rate'],
    compare: true,
));                                                  // Illuminate\Http\Client\Response

$result = Plausible::stats()->aggregateResult(AggregateRequest::make(
    site: 'my-site.com',
    metrics: [Metric::Visitors],
));                                                  // -> AggregateResult

$trend = Plausible::stats()->timeseriesResult(TimeseriesRequest::make(
    site: 'my-site.com',
    metrics: [Metric::Visitors],
    interval: Interval::Month,                       // date or month on the v1 endpoint
    period: Period::SixMonths,
));                                                  // -> TimeseriesResult

$pages = Plausible::stats()->breakdownResult(BreakdownRequest::make(
    site: 'my-site.com',
    property: Property::EventPage,
    filters: ['visit:country==FR'],
    perPage: 50,
));                                                  // -> BreakdownResult

$live = Plausible::stats()->realtime('my-site.com'); // int
```

## Request parameters

Every request has a static make() with named arguments; metrics, periods, intervals and properties accept enums or strings:

| Request | make() parameters and defaults |
| --- | --- |
| `AggregateRequest` | site, metrics = \['visitors'\], filters = \[\], period = '30d', start = null, end = null, compare = false |
| `TimeseriesRequest` | site, metrics = \['visitors'\], filters = \[\], interval = 'date', period = '30d', start = null, end = null |
| `BreakdownRequest` | site, property, metrics = \['visitors'\], filters = \[\], interval = 'date', period = '30d', start = null, end = null, page = 1, perPage = 100 |
| `QueryRequest` | site, metrics, dateRange = '30d', dimensions = \[\], filters = \[\], orderBy = \[\], include = \[\], limit = null, offset = null |

With explicit requests, pass period: Period::Custom yourself — only the fluent between() and since() switch the period for you. A custom period with only a start is closed at today (date=start,today); with any other period a lone start is the anchor date (period: 'month', start: 2024-01-01 is January 2024). v1 filters are strings in the legacy syntax, joined with a semicolon. The v1 limits apply here too: a TimeseriesRequest takes the date or month interval only, Period::Year is sent as a custom range from 1 January to today (or the request’s own dates), and Period::All throws UnsupportedRequest — all before anything is sent.

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