PHPackages                             picasticks/stravaclubtracker - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. picasticks/stravaclubtracker

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

picasticks/stravaclubtracker
============================

Progress tracker/dashboard generator for Strava Clubs that shows club totals, top efforts, individual leaders and club details

1.1.1(5y ago)2917710[1 PRs](https://github.com/picasticks/StravaClubTracker/pulls)GPL-3.0-onlyPHPPHP &gt;=7.4

Since Jan 15Pushed 4y ago4 watchersCompare

[ Source](https://github.com/picasticks/StravaClubTracker)[ Packagist](https://packagist.org/packages/picasticks/stravaclubtracker)[ Docs](https://github.com/picasticks/StravaClubTracker)[ RSS](/packages/picasticks-stravaclubtracker/feed)WikiDiscussions main Synced 1mo ago

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

[![banner](example/banner.png?raw=true)](example/banner.png?raw=true)

Strava Club Tracker
===================

[](#strava-club-tracker)

Strava club progress tracker/dashboard generator, uses [StravaPHP](https://github.com/basvandorst/StravaPHP/) to interface with the Strava API and total club members' stats. Generates views including club totals, individual leaders, club rosters and individuals' activity details.

Here's an [example screenshot](example/index.png?raw=true) of a main summary page, and of a club member's [activity detail](example/person_detail.png?raw=true) page. Here's the [composer package](https://packagist.org/packages/picasticks/stravaclubtracker).

Why?
----

[](#why)

As a charity fundraiser, a group I'm in held a month-long exercise challenge organized with multiple teams, and decided to use Strava Clubs to track each team's progress toward a group mileage goal. While Strava is great for tracking individual efforts, sharing photos etc., and the clubs were a great way to keep everyone motivated and organize group rides and walks, the default club views were too limited and didn't work for us. For example, totals did not include all activity types (they exclude Hike, Walk etc.), and we wanted to count various activity types differently (a 1-km swim is a lot harder than a 1-km ride!), and to see the whole group and all the clubs together as a single dashboard.

Main features
-------------

[](#main-features)

- Track one club or a group of clubs
- Club totals by activity and across activities
- Highlights top efforts
- Highlights individual leaders
- Club rosters and individual activity details, so participants can confirm at a glance that their activities were included
- Generates HTML output (swappable template callback)
- Configurable rules:
    - Configure distance units (miles, km, meters etc.)
    - Count mileage differently for each activity (e.g. 2x for Swim, 0.25x for Ride)
    - Combine multiple activity types (e.g. combine "Walk" and "Hike", or "Ride" and "VirtualRide")
    - Customize activity labels
    - Data quality/sanity checks for speed and duration, for when people inevitably forget to stop Strava and get in a car or a sofa. Changes 2 mph "runs" to walks, etc.
- Class methods to return totals and structured data
- CSV export

Quick start
-----------

[](#quick-start)

This library includes a simple example implementation in `/example`. In Strava, you'll need to have at least one club set up, with club members and completed activities (rides, runs, etc.). You'll need Strava API credentials.

To bootstrap the example:

1. Copy the `example` directory and its contents to a new project directory.
2. Change to the `lib` directory and use [Composer](https://getcomposer.org/) to install the library and its dependencies:

```
cd lib
composer install

```

3. Edit [`htdocs/example_update.php`](example/htdocs/example_update.php) and set the list of Strava Club IDs, start and end date, Strava API credentials and https callback URI. It's best to start by testing with a start/end period of just a few days.
4. Load `example_update.php` via https in a browser and click the link. It will obtain OAuth authorization from Strava and use the Strava API to download club data to the `json` directory.
5. Edit [`build.php`](example/build.php) and make any changes you like. By default, this script uses miles as distance unit and includes Ride, Run, Walk and Hike activities.
6. Run `build.php` from the CLI to generate HTML files into `htdocs/`.

```
php build.php

```

Needless to say, this example application isn't production quality and doesn't include access or authorization controls, it's meant for demo use only! It's split into two parts so that you can edit and rerun `build.php` offline many times to play with the generator functionality and syntax.

Strava permissions and club/person/activity visibility
------------------------------------------------------

[](#strava-permissions-and-clubpersonactivity-visibility)

Strava manages visibility of club details, members and activities according to its security and privacy policies. In order for club members to be included and their activities counted, each member must make their activities visible to your application's user. For example, a member could make activities visible to all users (currently, Strava's default setting), or only to Followers, and then accept your user as a Follower.

If a club member's activities don't show up, they should check their visibility settings in Strava and make sure they've made those activities visible to the club member user running your application.

Legal
-----

[](#legal)

This software library is protected by copyright and provided under the terms of the GNU GPL. See [LICENSE](LICENSE?raw=true) for details.

This library is designed to be used by applications that comply with [Strava's Terms of Service](https://www.strava.com/legal/terms) and other terms, including its privacy policy and API agreement. Of note, Strava's [API Agreement](https://www.strava.com/legal/api) states that the API should not be used to enable virtual races or competitions, or to replicate Strava sites, services or products. If you're thinking of adapting this library for a non-permitted use, please don't.

---

Class documentation
===================

[](#class-documentation)

picasticks\\Strava
------------------

[](#picasticksstrava)

- [Club](#picasticksstravaclub)
- [ClubTracker](#picasticksstravaclubtracker)

---

picasticks\\Strava\\Club
------------------------

[](#picasticksstravaclub)

### Methods

[](#methods)

NameDescription[\_\_construct](#club__construct)Constructor[downloadClub](#clubdownloadclub)Downloads club details from Strava[downloadClubActivities](#clubdownloadclubactivities)Downloads club activity data from Strava[getClubFilenames](#clubgetclubfilenames)Get array of club data files[getDataFilenames](#clubgetdatafilenames)Get map of club activity data files and timestamps[getRequestCount](#clubgetrequestcount)Get count of current number of API requests to Strava[log](#clublog)Log message using $this-logger[setClient](#clubsetclient)Set Strava API Client instance#### Club::\_\_construct

[](#club__construct)

**Description**

```
public __construct (string $storageDir)
```

Constructor

**Parameters**

- `(string) $storageDir`: filesystem directory to store downloaded JSON files

**Return Values**

`void`

---

#### Club::downloadClub

[](#clubdownloadclub)

**Description**

```
public downloadClub (int $clubId)
```

Downloads club details from Strava

**Parameters**

- `(int) $clubId`: Club ID

**Return Values**

`void`

---

#### Club::downloadClubActivities

[](#clubdownloadclubactivities)

**Description**

```
public downloadClubActivities (int $clubId, int $start, int $end)
```

Downloads club activity data from Strava

**Parameters**

- `(int) $clubId`: Club ID
- `(int) $start`: Start date (UNIX timestamp)
- `(int) $end`: End date (UNIX timestamp)

**Return Values**

`void`

---

#### Club::getClubFilenames

[](#clubgetclubfilenames)

**Description**

```
public getClubFilenames (void)
```

Get array of club data files

**Parameters**

`This function has no parameters.`

**Return Values**

`array`

> of filenames

---

#### Club::getDataFilenames

[](#clubgetdatafilenames)

**Description**

```
public getDataFilenames (int $clubId)
```

Get map of club activity data files and timestamps

**Parameters**

- `(int) $clubId`: Club ID

**Return Values**

`array`

> array('filename' =&gt; timestamp)

---

#### Club::getRequestCount

[](#clubgetrequestcount)

**Description**

```
public getRequestCount (void)
```

Get count of current number of API requests to Strava

**Parameters**

`This function has no parameters.`

**Return Values**

`int`

> request count

---

#### Club::log

[](#clublog)

**Description**

```
public log (string $msg, int|null $error_type)
```

Log message using $this-logger

**Parameters**

- `(string) $msg`: message
- `(int|null) $error_type`: (optional) PHP error type

**Return Values**

`void`

---

#### Club::setClient

[](#clubsetclient)

**Description**

```
public setClient (Client $client)
```

Set Strava API Client instance

**Parameters**

- `(Client) $client`: instance

**Return Values**

`void`

---

picasticks\\Strava\\ClubTracker
-------------------------------

[](#picasticksstravaclubtracker)

### Methods

[](#methods-1)

NameDescription[\_\_construct](#clubtracker__construct)Constructor[getCSV](#clubtrackergetcsv)Returns all activity data in CSV format[getClubHTML](#clubtrackergetclubhtml)Returns HTML club roster and totals for a club[getClubs](#clubtrackergetclubs)Return array of clubs and club attributes[getPersonHTML](#clubtrackergetpersonhtml)Returns HTML activty log for a single athlete[getPersonHTMLFilename](#clubtrackergetpersonhtmlfilename)Get filesystem path for HTML page showing person activity details[getResults](#clubtrackergetresults)Return hierarchical data structure of all activities grouped by club and athlete[getSportLeaders](#clubtrackergetsportleaders)Get ranked list of leaders for a sport/activity type[getSportLeadersHTML](#clubtrackergetsportleadershtml)Returns HTML table of leaders for a sport[getSummaryHTML](#clubtrackergetsummaryhtml)Returns main HTML summary tables[getTopActivities](#clubtrackergettopactivities)Get ranked list of top activities[getTopActivitiesHTML](#clubtrackergettopactivitieshtml)Returns HTML table of top performances for a sport/activity type[getTotal](#clubtrackergettotal)Get total distance, total or moving time[getTotals](#clubtrackergettotals)Get total distance, total and moving time[loadActivityData](#clubtrackerloadactivitydata)Load activity data from disk (downloaded JSON responses)[setSport](#clubtrackersetsport)Add or set a sport, including label and totaling rules[setTemplateFunction](#clubtrackersettemplatefunction)Set template function[whitelistActivity](#clubtrackerwhitelistactivity)Add activity to activity whitelist#### ClubTracker::\_\_construct

[](#clubtracker__construct)

**Description**

```
public __construct (Club $data)
```

Constructor

**Parameters**

- `(Club) $data`: Club instance object

**Return Values**

`void`

---

#### ClubTracker::getCSV

[](#clubtrackergetcsv)

**Description**

```
public getCSV (void)
```

Returns all activity data in CSV format

Includes header row

**Parameters**

`This function has no parameters.`

**Return Values**

`string`

> CSV-formatted data export

---

#### ClubTracker::getClubHTML

[](#clubtrackergetclubhtml)

**Description**

```
public getClubHTML (int $clubId)
```

Returns HTML club roster and totals for a club

Applies template name 'club'

**Parameters**

- `(int) $clubId`: Club ID

**Return Values**

`string`

> HTML

---

#### ClubTracker::getClubs

[](#clubtrackergetclubs)

**Description**

```
public getClubs (void)
```

Return array of clubs and club attributes

**Parameters**

`This function has no parameters.`

**Return Values**

`array`

> of (int) clubId =&gt; (array) club attributes

---

#### ClubTracker::getPersonHTML

[](#clubtrackergetpersonhtml)

**Description**

```
public getPersonHTML (int $clubId, string $person)
```

Returns HTML activty log for a single athlete

Applies template name 'person'

**Parameters**

- `(int) $clubId`: Club ID
- `(string) $person`: person name

**Return Values**

`string`

> HTML

---

#### ClubTracker::getPersonHTMLFilename

[](#clubtrackergetpersonhtmlfilename)

**Description**

```
public getPersonHTMLFilename (string $baseDir, int $clubId, string $person)
```

Get filesystem path for HTML page showing person activity details

**Parameters**

- `(string) $baseDir`: Filesystem base directory
- `(int) $clubId`: Club ID
- `(string) $person`: person name

**Return Values**

`string`

> filename

---

#### ClubTracker::getResults

[](#clubtrackergetresults)

**Description**

```
public getResults (void)
```

Return hierarchical data structure of all activities grouped by club and athlete

**Parameters**

`This function has no parameters.`

**Return Values**

`array`

> of activity data

---

#### ClubTracker::getSportLeaders

[](#clubtrackergetsportleaders)

**Description**

```
public getSportLeaders (string $sport)
```

Get ranked list of leaders for a sport/activity type

**Parameters**

- `(string) $sport`: sport ID

**Return Values**

`array`

> of: total distance, clubId, person name

---

#### ClubTracker::getSportLeadersHTML

[](#clubtrackergetsportleadershtml)

**Description**

```
public getSportLeadersHTML (string $sport, int $limit)
```

Returns HTML table of leaders for a sport

Applies template name 'leaders'

**Parameters**

- `(string) $sport`: sport ID
- `(int) $limit`: (optional) number of athletes to include (defaults to top 5)

**Return Values**

`string`

> HTML

---

#### ClubTracker::getSummaryHTML

[](#clubtrackergetsummaryhtml)

**Description**

```
public getSummaryHTML (void)
```

Returns main HTML summary tables

Includes standings, top individual performances, club totals

Applies template name 'index'

**Parameters**

`This function has no parameters.`

**Return Values**

`string`

> HTML

---

#### ClubTracker::getTopActivities

[](#clubtrackergettopactivities)

**Description**

```
public getTopActivities (int $clubId, string $person, string $sport)
```

Get ranked list of top activities

Optionally filter by club, person and sport

**Parameters**

- `(int) $clubId`: (optional) Club ID
- `(string) $person`: (optional) person name
- `(string) $sport`: (optional) sport ID

**Return Values**

`array`

> of activity data: total, distance, clubId, person name, date, activity name, sport

---

#### ClubTracker::getTopActivitiesHTML

[](#clubtrackergettopactivitieshtml)

**Description**

```
public getTopActivitiesHTML (string $sport, int $limit)
```

Returns HTML table of top performances for a sport/activity type

Applies template name 'activities'

**Parameters**

- `(string) $sport`: sport ID
- `(int) $limit`: (optional) number of athletes to include (defaults to top 5)

**Return Values**

`string`

> HTML

---

#### ClubTracker::getTotal

[](#clubtrackergettotal)

**Description**

```
public getTotal (string $type, int $clubId, string $person, string $sport)
```

Get total distance, total or moving time

Optionally filter by club, person and sport

**Parameters**

- `(string) $type`: 'distance' 'total' or 'moving\_time'
- `(int) $clubId`: (optional) Club ID
- `(string) $person`: (optional) person name
- `(string) $sport`: (optional) sport ID

**Return Values**

`mixed`

> (float) distance or total, (int) moving\_time

---

#### ClubTracker::getTotals

[](#clubtrackergettotals)

**Description**

```
public getTotals (int $clubId, string $person, string $sport)
```

Get total distance, total and moving time

Optionally filter by club, person and sport

**Parameters**

- `(int) $clubId`: (optional) Club ID
- `(string) $person`: (optional) person name
- `(string) $sport`: (optional) sport ID

**Return Values**

`array`

> of: distance, total, moving\_time totals

---

#### ClubTracker::loadActivityData

[](#clubtrackerloadactivitydata)

**Description**

```
public loadActivityData (void)
```

Load activity data from disk (downloaded JSON responses)

Calculates totals and stores as hierarchical data structure of all activities grouped by club and athlete.

Sets $this-&gt;start and $this-&gt;end using activity dates.

**Parameters**

`This function has no parameters.`

**Return Values**

`void`

---

#### ClubTracker::setSport

[](#clubtrackersetsport)

**Description**

```
public setSport (string $sportId, array $attributes)
```

Add or set a sport, including label and totaling rules

Attributes may include:

string $label (optional) to use for sport name in formatted output (if not set, $sportId is used).

string $convertTo (optional) sport ID of another sport to which this sport ID's activities should be converted. Use to combine multiple Strava sports together for simplified reporting, e.g. to merge "Walk" and "Hike".

float $distanceMultiplier (optional) Multiplier to apply to distance to compute adjusted total. e.g. setting Ride to 0.25 and Walk to 1 means each Walk mile is counted the same as 4 Ride miles.

float $maxSpeed (optional) Maximum speed for a single activity for a sport, in distance units per hour. Activities that exceed this limit are counted as 0 (the user should edit them in Strava and either set the correct activity type, or edit the activity to remove distance covered in a vehicle).

float $distanceLimit (optional) Hard distance limit for a single activity for a sport. Activities that exceed this limit are counted up to the distanceLimit.

**Parameters**

- `(string) $sportId`: sport ID
- `(array) $attributes`: (optional)

**Return Values**

`void`

---

#### ClubTracker::setTemplateFunction

[](#clubtrackersettemplatefunction)

**Description**

```
public setTemplateFunction (callable $function)
```

Set template function

**Parameters**

- `(callable) $function`: callable to apply array of template variables to template

**Return Values**

`void`

---

#### ClubTracker::whitelistActivity

[](#clubtrackerwhitelistactivity)

**Description**

```
public whitelistActivity (string $id)
```

Add activity to activity whitelist

Whitelisted activities are always counted, bypassing sanity checks

**Parameters**

- `(string) $id`: activity ID

**Return Values**

`void`

---

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity55

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 ~2 days

Total

3

Last Release

1940d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/08873c55de096458b135ea1b3191cf533fcea4f0f993eb588f510b9fba30fb3f?d=identicon)[picasticks](/maintainers/picasticks)

---

Top Contributors

[![picasticks](https://avatars.githubusercontent.com/u/3988667?v=4)](https://github.com/picasticks "picasticks (36 commits)")

---

Tags

strava

### Embed Badge

![Health badge](/badges/picasticks-stravaclubtracker/health.svg)

```
[![Health](https://phpackages.com/badges/picasticks-stravaclubtracker/health.svg)](https://phpackages.com/packages/picasticks-stravaclubtracker)
```

###  Alternatives

[cuneytyuksel/turkey-cities

Turkey Cities and States - Türkiye İl ve İlçeler (PTT)

251.8k](/packages/cuneytyuksel-turkey-cities)

PHPackages © 2026

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