PHPackages                             dlondero/strava-objects - 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. dlondero/strava-objects

ActiveLibrary[API Development](/categories/api)

dlondero/strava-objects
=======================

PHP Data Transfer Objects to interact with Strava API V3

12PHP

Since Aug 20Pushed 6y ago2 watchersCompare

[ Source](https://github.com/dlondero/strava-objects)[ Packagist](https://packagist.org/packages/dlondero/strava-objects)[ RSS](/packages/dlondero-strava-objects/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

StravaObjects
=============

[](#stravaobjects)

[![Build Status](https://camo.githubusercontent.com/8447f4a9f6ba29a3147a5da01a899e31a883016660f4c0678618b3c7426a10e6/68747470733a2f2f7472617669732d63692e6f72672f646c6f6e6465726f2f7374726176612d6f626a656374732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/dlondero/strava-objects)

TL;DR PHP model classes for Strava V3 API responses

The [Strava V3 API](https://developers.strava.com/docs/reference/) is the public interface allowing developers to access the rich [Strava](https://www.strava.com/) dataset. Retrieving information directly from the API or using one of the PHP client libraries available leaves us to work with JSON responses (to decode) or with the usual array of data.

The goal of this package is to give structure to unstructured data stored in associative arrays. Model objects representing Strava models will give us the following advantages:

- We're able to **type hint** all responses
- Defined types for all propertis of our objects, so we're sure that their values are what we expect
- Because of typed properties, we can statically analyze them and have **auto completion**.

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

[](#requirements)

- PHP &gt;= 7.4

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

[](#installation)

Using Composer:

```
composer require dlondero/strava-objects
```

Otherwise just download the package and add it to your autoloader. Namespaces are PSR-4 compliant.

Usage
-----

[](#usage)

Let's look at the example to get an [activity](https://developers.strava.com/docs/reference/#api-Activities-getActivityById)(imagine to use a client library which returns associative arrays):

```
$response = $client->getActivity(12345);

[
    'id' => 12345,
    'name' => 'Foo',
    'distance' => 28099,
    ...
]
```

Working with this array is difficult, as we'll always have to lookup to the documentation to know what's exactly in it. This package allows to instantiate proper objects for all models using the response array of data.

**Every model defined in Strava documentation is mapped 1:1 in this library so it's easy to understance which object to create with a specific response from the API.**

```
// According to Stava docs `getActivityById` returns the representation of
// `DetailedActivity`. So we can use its response to create an instance of
// that model provided by StravaObjects.

use StravaObjects\Objects\DetailedActivity;

$response = $client->getActivityById(12345);
$detailedActivity = DetailedActivity::create($response);
```

Now we can use this data in a structured way thanks to the accessors of each model and auto completion in our preferred IDE.

### Collections

[](#collections)

Many endpoints of Strava API return an array of objects (their representation), for such reason StravaObjects provides many collections implementing `IteratorAggregate` interface. Passing the response to `Collection::create()` will create the collection and all its typed elements.

```
// According to Strava docs `getLoggedInAthleteActivities` returns an
// array of `SummaryActivity` objects. Creating the related collection
// is a one liner operation.

use StravaObjects\Collections\Collection;
use StravaObjects\Objects\SummaryActivity;

$response = $client->getLoggedInAthleteActivities();
$summaryActivityCollection = Collection::create($response, SummaryActivity::class);
```

Development
-----------

[](#development)

The StravaObjects library was created by Daniel Londero, [software engineer](https://remote-developer.io/) and [ultratrail runner](https://www.strava.com/athletes/16365833).

License
-------

[](#license)

The StravaObjects library is open-source software licensed under MIT license.

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1bc693aa75d3cab07a5b774fb7c27cb7474d674023bddd2c486cc03d5f9e1697?d=identicon)[dlondero](/maintainers/dlondero)

---

Top Contributors

[![dlondero](https://avatars.githubusercontent.com/u/209782?v=4)](https://github.com/dlondero "dlondero (12 commits)")

### Embed Badge

![Health badge](/badges/dlondero-strava-objects/health.svg)

```
[![Health](https://phpackages.com/badges/dlondero-strava-objects/health.svg)](https://phpackages.com/packages/dlondero-strava-objects)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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