PHPackages                             oi-lab/oi-laravel-umami - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. oi-lab/oi-laravel-umami

ActiveLibrary[API Development](/categories/api)

oi-lab/oi-laravel-umami
=======================

Laravel wrapper for the Umami analytics REST API returning typed spatie/laravel-data DTOs.

v1.0.2(1mo ago)0263↓50%MITPHPPHP ^8.2CI failing

Since Jun 28Pushed 1mo agoCompare

[ Source](https://github.com/oi-lab/oi-laravel-umami)[ Packagist](https://packagist.org/packages/oi-lab/oi-laravel-umami)[ RSS](/packages/oi-lab-oi-laravel-umami/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependencies (8)Versions (4)Used By (0)

[![OI Laravel TypeScript Generator](./assets/github-preview.png)](./assets/github-preview.png)

OI Laravel Umami
================

[](#oi-laravel-umami)

[![Latest Version on Packagist](https://camo.githubusercontent.com/db36fb4f79bc8243d4cb61f18a2107ea85b11835bbb073086d588f30393cd8a7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f692d6c61622f6f692d6c61726176656c2d74732e737667)](https://packagist.org/packages/oi-lab/oi-laravel-ts)[![Total Downloads](https://camo.githubusercontent.com/86456ffc6cc59695c0b7a9cf4b1f4919bd9e0c3e7b6a9e1b3bfc491d8c5d9fd1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f692d6c61622f6f692d6c61726176656c2d74732e737667)](https://packagist.org/packages/oi-lab/oi-laravel-ts)[![Tests](https://camo.githubusercontent.com/328a59644a055d910db59ec07ad1dc55d89d55c73e9da030a6e5e0b7253c94c1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6f692d6c61622f6f692d6c61726176656c2d74732f74657374732e796d6c3f6c6162656c3d7465737473)](https://github.com/oi-lab/oi-laravel-ts/actions)[![License](https://camo.githubusercontent.com/50bd97e422fd2bd48b6396a0b85ae534cf8970357c8562a622fa6fbb374abaa6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6f692d6c61622f6f692d6c61726176656c2d7473)](LICENSE)

A typed Laravel wrapper around the [Umami](https://umami.is) analytics REST API. Works with **Umami Cloud** (API key) and **self-hosted** instances (username/password), caches reporting responses, and returns [spatie/laravel-data](https://spatie.be/docs/laravel-data)DTOs — discoverable by [`oi-lab/oi-laravel-ts`](https://github.com/oi-lab) for TypeScript generation.

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11, 12, or 13
- `spatie/laravel-data` ^4.0

Installation
------------

[](#installation)

```
composer require oi-lab/oi-laravel-umami
```

Publish the configuration:

```
php artisan vendor:publish --tag=oi-laravel-umami-config
```

Configuration
-------------

[](#configuration)

Umami Cloud:

```
UMAMI_BASE_URL=https://api.umami.is/v1
UMAMI_API_KEY=your-api-key
UMAMI_WEBSITE_ID=your-website-uuid
```

Self-hosted (note the trailing `/api`):

```
UMAMI_BASE_URL=https://stats.example.com/api
UMAMI_USERNAME=admin
UMAMI_PASSWORD=secret
UMAMI_WEBSITE_ID=your-website-uuid
```

When `UMAMI_API_KEY` is set the client sends the `x-umami-api-key` header; otherwise it logs in with the username/password and caches the bearer token. Reporting responses are cached (`UMAMI_CACHE_TTL`, default 300s).

Usage
-----

[](#usage)

Use the `Umami` facade or inject `OiLab\OiLaravelUmami\Client`.

### Reporting

[](#reporting)

```
use OiLab\OiLaravelUmami\Facades\Umami;
use Illuminate\Support\Carbon;

// Defaults to the configured website and the last 7 days.
$stats = Umami::stats();
$stats->pageviews->value;   // int
$stats->visitors->prev;     // ?int (previous period)

Umami::activeVisitors()->visitors;          // int
Umami::pageviews()->pageviews;              // DataPointData[]
Umami::metrics(options: ['type' => 'url']); // Collection

// Custom range + bypass cache
Umami::stats(websiteId: 'site-uuid', options: [
    'startAt' => Carbon::now()->subMonth(),
    'endAt' => Carbon::now(),
], fresh: true);
```

`startAt` / `endAt` accept `Carbon`, `DateTimeInterface`, date strings, or epoch milliseconds.

### Websites &amp; users

[](#websites--users)

```
Umami::websites();                                   // Collection
Umami::createWebsite(['name' => 'Site', 'domain' => 'example.com']);
Umami::updateWebsite('site-uuid', ['name' => 'Renamed']);
Umami::deleteWebsite('site-uuid');                   // bool

Umami::users();                                      // Collection
Umami::createUser(['username' => 'jane', 'password' => 'secret']);
Umami::deleteUser('user-id');                        // bool
```

DTOs &amp; TypeScript
---------------------

[](#dtos--typescript)

Responses are `spatie/laravel-data` objects under `OiLab\OiLaravelUmami\Data`(`WebsiteStatsData`, `PageviewsData`, `MetricData`, `WebsiteData`, `UserData`, …). To generate TypeScript interfaces, add the namespace to `config/oi-laravel-ts.php`:

```
'data_namespaces' => [
    'OiLab\\OiLaravelUmami\\Data',
],
```

then run `php artisan oi:gen-ts`.

Testing
-------

[](#testing)

```
composer test
```

AI Assistant Skills
-------------------

[](#ai-assistant-skills)

Install the bundled skill into your app:

```
php artisan oi:install-ai-skill
```

This copies `oilab-laravel-umami` into your `.claude/` and `.junie/` skill directories and updates your root `CLAUDE.md`.

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

When contributing:

1. Write tests for new features
2. Ensure all tests pass: `vendor/bin/pest`
3. Follow existing code style
4. Update documentation as needed

License
-------

[](#license)

This package is open-source software licensed under the [MIT license](LICENSE).

Credits
-------

[](#credits)

**[Olivier Lacombe](https://www.olacombe.com)** - Creator and maintainer

Olivier is a Product &amp; Technology Director based in Montpellier, France, with over 20 years of experience innovating in UX/UI and emerging technologies. He specializes in guiding enterprises toward cutting-edge digital solutions, combining user-centered design with continuous optimization and artificial intelligence integration.

**Projects &amp; Resources:**

- [OI Dev Docs](https://dev.olacombe.com) - Documentation for all Open Source OI Lab packages
- [OnAI](https://onai.olacombe.com) - Training courses and masterclasses on generative AI for businesses
- [Promptr](https://promptr.olacombe.com) - Prompt engineering Management Platform

Support
-------

[](#support)

For support, please open an issue on the [GitHub repository](https://github.com/oi-lab/oi-laravel-umami/issues).

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance90

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

45d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/369876?v=4)[Olivier Lacombe](/maintainers/olacombe)[@olacombe](https://github.com/olacombe)

---

Top Contributors

[![olacombe](https://avatars.githubusercontent.com/u/369876?v=4)](https://github.com/olacombe "olacombe (2 commits)")

---

Tags

laravelanalyticsdtoumamispatie-data

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/oi-lab-oi-laravel-umami/health.svg)

```
[![Health](https://phpackages.com/badges/oi-lab-oi-laravel-umami/health.svg)](https://phpackages.com/packages/oi-lab-oi-laravel-umami)
```

###  Alternatives

[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k161.4k2](/packages/mike-bronner-laravel-model-caching)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

818355.4k3](/packages/defstudio-telegraph)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5226.7k](/packages/simplestats-io-laravel-client)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
