PHPackages                             jeffersongoncalves/laravel-metrics-fathom - 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. [Admin Panels](/categories/admin)
4. /
5. jeffersongoncalves/laravel-metrics-fathom

ActiveLibrary[Admin Panels](/categories/admin)

jeffersongoncalves/laravel-metrics-fathom
=========================================

Laravel package to interact with Fathom Analytics API - fetch pageviews, visitors, events, and generate custom reports

v1.0.0(2mo ago)3101MITPHPPHP ^8.2CI passing

Since Mar 2Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/jeffersongoncalves/laravel-metrics-fathom)[ Packagist](https://packagist.org/packages/jeffersongoncalves/laravel-metrics-fathom)[ GitHub Sponsors](https://github.com/jeffersongoncalves)[ RSS](/packages/jeffersongoncalves-laravel-metrics-fathom/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (9)Versions (2)Used By (1)

[![Laravel Metrics Fathom](https://raw.githubusercontent.com/jeffersongoncalves/laravel-metrics-fathom/main/art/jeffersongoncalves-laravel-metrics-fathom.png)](https://raw.githubusercontent.com/jeffersongoncalves/laravel-metrics-fathom/main/art/jeffersongoncalves-laravel-metrics-fathom.png)

Laravel Metrics Fathom
======================

[](#laravel-metrics-fathom)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5a6fe72059463bd68ca072304c159e5606e2bdab2072a46db497a6ebdbc5c65d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6566666572736f6e676f6e63616c7665732f6c61726176656c2d6d6574726963732d666174686f6d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jeffersongoncalves/laravel-metrics-fathom)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/c8e6e2d55b14894be4311d050a09d64706b7568b61994191b73d3e2fd858746d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a6566666572736f6e676f6e63616c7665732f6c61726176656c2d6d6574726963732d666174686f6d2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/jeffersongoncalves/laravel-metrics-fathom/actions?query=workflow%3A%22Fix+PHP+code+styling%22+branch%3Amain)[![PHPStan](https://camo.githubusercontent.com/b5c6d43dd423e53a721ce57352ef343738ddc9afa5939cf394513bfe92c66b96/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a6566666572736f6e676f6e63616c7665732f6c61726176656c2d6d6574726963732d666174686f6d2f7068707374616e2e796d6c3f6272616e63683d6d61696e266c6162656c3d5048505374616e267374796c653d666c61742d737175617265)](https://github.com/jeffersongoncalves/laravel-metrics-fathom/actions?query=workflow%3APHPStan+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/00b98972cbc776f69dc87eb2a0cd3a1fa681e156b89597831af9d54992dc9e9a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a6566666572736f6e676f6e63616c7665732f6c61726176656c2d6d6574726963732d666174686f6d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jeffersongoncalves/laravel-metrics-fathom)

Laravel package to interact with the [Fathom Analytics](https://usefathom.com) API. Fetch pageviews, visitors, events, milestones, and generate custom aggregation reports.

Settings are stored in the database via [spatie/laravel-settings](https://github.com/spatie/laravel-settings) — no config files needed.

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

[](#installation)

```
composer require jeffersongoncalves/laravel-metrics-fathom
```

Run migrations to create the settings:

```
php artisan migrate
```

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

[](#configuration)

After migration, the settings are seeded from environment variables:

```
FATHOM_API_TOKEN=your-api-token
FATHOM_SITE_ID=your-site-id
FATHOM_BASE_URL=https://api.usefathom.com/v1
FATHOM_TIMEZONE=UTC
```

You can also update settings programmatically:

```
use JeffersonGoncalves\MetricsFathom\Settings\FathomSettings;

$settings = app(FathomSettings::class);
$settings->api_token = 'new-token';
$settings->site_id = 'NEWSITE';
$settings->timezone = 'America/Sao_Paulo';
$settings->save();
```

Usage
-----

[](#usage)

### Using the Facade

[](#using-the-facade)

```
use JeffersonGoncalves\MetricsFathom\Facades\Fathom;
```

### Account

[](#account)

```
$account = Fathom::account();
```

### Sites

[](#sites)

```
// List sites
$result = Fathom::sites(limit: 20);
foreach ($result['data'] as $site) {
    echo $site->id . ' - ' . $site->name;
}

// Get a site
$site = Fathom::site('SITEID');

// Create a site
use JeffersonGoncalves\MetricsFathom\Enums\Sharing;
$site = Fathom::createSite('My Site', Sharing::Public);

// Update a site
$site = Fathom::updateSite('SITEID', name: 'New Name');

// Delete a site
Fathom::deleteSite('SITEID');
```

### Events

[](#events)

```
// List events
$result = Fathom::events();

// Create an event
$event = Fathom::createEvent('signup');

// Get an event
$event = Fathom::event('EVENTID');

// Update an event
$event = Fathom::updateEvent('EVENTID', 'new-name');

// Delete an event
Fathom::deleteEvent('EVENTID');
```

### Milestones

[](#milestones)

```
// List milestones
$result = Fathom::milestones();

// Create a milestone
$milestone = Fathom::createMilestone('v2.0 Launch', '2026-03-01');

// Update a milestone
$milestone = Fathom::updateMilestone('MSID', name: 'v2.1 Launch');

// Delete a milestone
Fathom::deleteMilestone('MSID');
```

### Current Visitors

[](#current-visitors)

```
// Simple count
$visitors = Fathom::currentVisitors();
echo $visitors->total; // 42

// Detailed (top pages & referrers)
$visitors = Fathom::currentVisitors(detailed: true);
```

### Aggregations (Custom Reports)

[](#aggregations-custom-reports)

Build flexible reports using the fluent query builder:

```
use JeffersonGoncalves\MetricsFathom\Enums\Aggregate;
use JeffersonGoncalves\MetricsFathom\Enums\DateGrouping;
use JeffersonGoncalves\MetricsFathom\Enums\FieldGrouping;
use JeffersonGoncalves\MetricsFathom\Enums\FilterOperator;

// Pageviews per day for the last month
$query = Fathom::query()
    ->aggregate(Aggregate::Visits, Aggregate::Pageviews, Aggregate::BounceRate)
    ->groupByDate(DateGrouping::Day)
    ->from('2026-02-01 00:00:00')
    ->to('2026-02-28 23:59:59');

$result = Fathom::aggregate($query);

// Top pages by visits
$query = Fathom::query()
    ->aggregate(Aggregate::Visits)
    ->groupByField(FieldGrouping::Pathname)
    ->sortBy('visits', 'desc')
    ->limit(10);

$result = Fathom::aggregate($query);

// Visitors by country
$query = Fathom::query()
    ->aggregate(Aggregate::Uniques)
    ->groupByField(FieldGrouping::CountryCode)
    ->sortBy('uniques', 'desc');

$result = Fathom::aggregate($query);

// Filter by UTM source
$query = Fathom::query()
    ->aggregate(Aggregate::Visits, Aggregate::Uniques)
    ->where(FieldGrouping::UtmSource, FilterOperator::Is, 'twitter')
    ->from('2026-01-01 00:00:00');

$result = Fathom::aggregate($query);

// Event conversions
$query = Fathom::queryEvents()
    ->aggregate(Aggregate::Conversions, Aggregate::UniqueConversions)
    ->forSite('SITEID')
    ->forEvent('signup')
    ->groupByDate(DateGrouping::Month);

$result = Fathom::aggregate($query);
```

### Using DateTime Objects

[](#using-datetime-objects)

```
use Carbon\Carbon;

$query = Fathom::query()
    ->aggregate(Aggregate::Visits)
    ->between(Carbon::now()->subDays(30), Carbon::now());

$result = Fathom::aggregate($query);
```

Available Enums
---------------

[](#available-enums)

### Aggregate

[](#aggregate)

`Visits`, `Uniques`, `Pageviews`, `AvgDuration`, `BounceRate`, `Conversions`, `UniqueConversions`, `Value`

### DateGrouping

[](#dategrouping)

`Hour`, `Day`, `Month`, `Year`

### FieldGrouping

[](#fieldgrouping)

`Hostname`, `Pathname`, `ReferrerHostname`, `Referrer`, `Browser`, `BrowserVersion`, `CountryCode`, `City`, `DeviceType`, `OperatingSystem`, `OperatingSystemVersion`, `UtmSource`, `UtmMedium`, `UtmCampaign`, `UtmContent`, `UtmTerm`

### FilterOperator

[](#filteroperator)

`Is`, `IsNot`, `IsLike`, `IsNotLike`, `Matching`, `NotMatching`

### Sharing

[](#sharing)

`None`, `Private`, `Public`

API Rate Limits
---------------

[](#api-rate-limits)

- **Sites &amp; Events**: 2,000 requests/hour
- **Aggregations &amp; Current Visitors**: 10 requests/minute

Testing
-------

[](#testing)

```
composer test
```

Code Style
----------

[](#code-style)

```
composer format
```

Static Analysis
---------------

[](#static-analysis)

```
composer analyse
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance89

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% 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

Unknown

Total

1

Last Release

71d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/411493?v=4)[Jefferson Gonçalves](/maintainers/jeffersongoncalves)[@jeffersongoncalves](https://github.com/jeffersongoncalves)

---

Top Contributors

[![jeffersongoncalves](https://avatars.githubusercontent.com/u/411493?v=4)](https://github.com/jeffersongoncalves "jeffersongoncalves (8 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

analyticscomposerdashboardfathomfathom-analyticsjeffersongoncalveslaravellaravel-packagemetricspageviewsphpprivacyreportingspatie-laravel-settingslaravelMetricsanalyticsvisitorsprivacyfathompageviews

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/jeffersongoncalves-laravel-metrics-fathom/health.svg)

```
[![Health](https://phpackages.com/badges/jeffersongoncalves-laravel-metrics-fathom/health.svg)](https://phpackages.com/packages/jeffersongoncalves-laravel-metrics-fathom)
```

###  Alternatives

[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.2M51](/packages/spatie-laravel-responsecache)[bezhansalleh/filament-google-analytics

Google Analytics integration for FilamentPHP

205144.8k5](/packages/bezhansalleh-filament-google-analytics)[andreaselia/analytics

Analytics for the Laravel framework.

19719.5k2](/packages/andreaselia-analytics)[a2insights/filament-saas

Filament Saas for A2Insights

161.1k](/packages/a2insights-filament-saas)

PHPackages © 2026

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