Download the PHP package picasticks/stravaclubtracker without Composer

On this page you can find all versions of the php package picasticks/stravaclubtracker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package stravaclubtracker

Strava Club Tracker

Strava club progress tracker/dashboard generator, uses 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 composer package.

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

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 to install the library and its dependencies:

  3. Edit 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 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/.

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

This software library is protected by copyright and provided under the terms of the GNU GPL. See LICENSE for details.

This library is designed to be used by applications that comply with Strava's Terms of Service and other terms, including its privacy policy and API agreement. Of note, Strava's API Agreement 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

picasticks\Strava


picasticks\Strava\Club

Methods

Name Description
__construct Constructor
downloadClub Downloads club details from Strava
downloadClubActivities Downloads club activity data from Strava
getClubFilenames Get array of club data files
getDataFilenames Get map of club activity data files and timestamps
getRequestCount Get count of current number of API requests to Strava
log Log message using $this-logger
setClient Set Strava API Client instance

Club::__construct

Description

Constructor

Parameters

Return Values

void


Club::downloadClub

Description

Downloads club details from Strava

Parameters

Return Values

void


Club::downloadClubActivities

Description

Downloads club activity data from Strava

Parameters

Return Values

void


Club::getClubFilenames

Description

Get array of club data files

Parameters

This function has no parameters.

Return Values

array

of filenames


Club::getDataFilenames

Description

Get map of club activity data files and timestamps

Parameters

Return Values

array

array('filename' => timestamp)


Club::getRequestCount

Description

Get count of current number of API requests to Strava

Parameters

This function has no parameters.

Return Values

int

request count


Club::log

Description

Log message using $this-logger

Parameters

Return Values

void


Club::setClient

Description

Set Strava API Client instance

Parameters

Return Values

void


picasticks\Strava\ClubTracker

Methods

Name Description
__construct Constructor
getCSV Returns all activity data in CSV format
getClubHTML Returns HTML club roster and totals for a club
getClubs Return array of clubs and club attributes
getPersonHTML Returns HTML activty log for a single athlete
getPersonHTMLFilename Get filesystem path for HTML page showing person activity details
getResults Return hierarchical data structure of all activities grouped by club and athlete
getSportLeaders Get ranked list of leaders for a sport/activity type
getSportLeadersHTML Returns HTML table of leaders for a sport
getSummaryHTML Returns main HTML summary tables
getTopActivities Get ranked list of top activities
getTopActivitiesHTML Returns HTML table of top performances for a sport/activity type
getTotal Get total distance, total or moving time
getTotals Get total distance, total and moving time
loadActivityData Load activity data from disk (downloaded JSON responses)
setSport Add or set a sport, including label and totaling rules
setTemplateFunction Set template function
whitelistActivity Add activity to activity whitelist

ClubTracker::__construct

Description

Constructor

Parameters

Return Values

void


ClubTracker::getCSV

Description

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

Description

Returns HTML club roster and totals for a club

Applies template name 'club'

Parameters

Return Values

string

HTML


ClubTracker::getClubs

Description

Return array of clubs and club attributes

Parameters

This function has no parameters.

Return Values

array

of (int) clubId => (array) club attributes


ClubTracker::getPersonHTML

Description

Returns HTML activty log for a single athlete

Applies template name 'person'

Parameters

Return Values

string

HTML


ClubTracker::getPersonHTMLFilename

Description

Get filesystem path for HTML page showing person activity details

Parameters

Return Values

string

filename


ClubTracker::getResults

Description

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

Description

Get ranked list of leaders for a sport/activity type

Parameters

Return Values

array

of: total distance, clubId, person name


ClubTracker::getSportLeadersHTML

Description

Returns HTML table of leaders for a sport

Applies template name 'leaders'

Parameters

Return Values

string

HTML


ClubTracker::getSummaryHTML

Description

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

Description

Get ranked list of top activities

Optionally filter by club, person and sport

Parameters

Return Values

array

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


ClubTracker::getTopActivitiesHTML

Description

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

Applies template name 'activities'

Parameters

Return Values

string

HTML


ClubTracker::getTotal

Description

Get total distance, total or moving time

Optionally filter by club, person and sport

Parameters

Return Values

mixed

(float) distance or total, (int) moving_time


ClubTracker::getTotals

Description

Get total distance, total and moving time

Optionally filter by club, person and sport

Parameters

Return Values

array

of: distance, total, moving_time totals


ClubTracker::loadActivityData

Description

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->start and $this->end using activity dates.

Parameters

This function has no parameters.

Return Values

void


ClubTracker::setSport

Description

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

Return Values

void


ClubTracker::setTemplateFunction

Description

Set template function

Parameters

Return Values

void


ClubTracker::whitelistActivity

Description

Add activity to activity whitelist

Whitelisted activities are always counted, bypassing sanity checks

Parameters

Return Values

void



All versions of stravaclubtracker with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
basvandorst/stravaphp Version ^1.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package picasticks/stravaclubtracker contains the following files

Loading the files please wait ....