---
title: "Without the facade — Metrics for Laravel | Roundly"
description: "Inject MetricsManager for the same API without static calls, or use metric classes on their own — no registry, no facade."
url: https://roundly-consulting.com/open-source/docs/metrics-for-laravel/without-facade
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)

# Without the facade

The facade is the recommended default, not the only way in. It’s a thin layer over RoundlyConsulting\\Metrics\\MetricsManager, the facade root — inject it through the constructor for the same API with an explicit dependency and no static calls:

```php
use App\Models\User;
use RoundlyConsulting\Metrics\MetricsManager;

final class DashboardController
{
    public function __construct(private MetricsManager $metrics) {}

    public function __invoke(): array
    {
        return [
            'revenue' => $this->metrics->get('revenue')->result()->value(),
            'signups' => $this->metrics->value()->count(User::query())->range('TODAY')->result()->value(),
        ];
    }
}
```

Metrics::fake() swaps the manager behind the facade and in the container, so an injected MetricsManager gets the fake too.

## Metric classes on their own

A metric class works without the registry or the facade — make it, or resolve it through the container:

```php
RegisteredUsers::make()->range('TODAY')->result();   // ValueResult
app(RegisteredUsers::class)->toArray();             // resolved through the container
```

## No action classes

Metrics is a calculation package, so it has no action classes: the builders and your metric classes are the behaviour, and the manager only registers, resolves and invalidates them.

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