---
title: "Dashboards — Metrics for Laravel | Roundly"
description: "Resolve many registered metrics in one call into a single keyed payload that shares one range and, optionally, one timezone."
url: https://roundly-consulting.com/open-source/docs/metrics-for-laravel/dashboards
language: en
---

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

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

# Dashboards

Metrics::dashboard() resolves a list of registered metrics at once into a single keyed envelope, sharing one range and, optionally, one timezone — ideal for a dashboard endpoint:

```php
use RoundlyConsulting\Metrics\Enums\Period;
use RoundlyConsulting\Metrics\Facades\Metrics;

return Metrics::dashboard(['users', 'revenue', 'churn'])
    ->range(Period::ThisMonth)
    ->timezone('America/New_York')   // optional shared timezone
    ->toArray();
// ['users' => [...envelope...], 'revenue' => [...], 'churn' => [...]]

// A custom window works the same way
Metrics::dashboard(['users', 'revenue'])
    ->range(Period::Custom, '2024-01-01 00:00:00', '2024-03-01 00:00:00')
    ->toArray();
```

- range(Period|string $range, ?string $customRangeStart = null, ?string $customRangeEnd = null) — applied to every metric; without it, each metric keeps its own range.
- timezone(?string $timezone) — resolve every metric in a shared timezone.
- toArray() — the keyed envelope, one entry per key, in the order given.

## Returning a dashboard

Dashboard is Responsable, so a controller returns it directly and gets the JSON envelope:

```php
public function index()
{
    return Metrics::dashboard(['users', 'revenue', 'churn'])->range(request('period', 'TODAY'));
}
```

Every key must be registered — an unknown key throws UnknownMetricException when the dashboard resolves.

## 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/metrics-for-laravel.md)
