PHPackages                             namelivia/fitbit-http-php - 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. namelivia/fitbit-http-php

AbandonedArchivedLibrary[API Development](/categories/api)

namelivia/fitbit-http-php
=========================

PHP SDK for accessing the Fitbit API

0.0.15(4y ago)103.5k4[11 issues](https://github.com/namelivia/fitbit-http-php/issues)1MITPHPPHP ^7.3|^8.0

Since Jul 24Pushed 3y ago1 watchersCompare

[ Source](https://github.com/namelivia/fitbit-http-php)[ Packagist](https://packagist.org/packages/namelivia/fitbit-http-php)[ RSS](/packages/namelivia-fitbit-http-php/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (5)Versions (17)Used By (1)

fitbit-http-php [![tag](https://camo.githubusercontent.com/a6e420d46e33729cb7646d118f6e2c50e92c73a04e0025f8f1534e522431ba45/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f6e616d656c697669612f6669746269742d687474702d7068702e737667)](https://github.com/namelivia/fitbit-http-php/releases) [![Build Status](https://camo.githubusercontent.com/761164e001b2ec1c53575328a2dfd30d0ab7fa8ef161f7bc06e6f541b9b5c6a3/68747470733a2f2f7472617669732d63692e6f72672f6e616d656c697669612f6669746269742d687474702d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/namelivia/fitbit-http-php) [![codecov](https://camo.githubusercontent.com/caa166e2e0b917721b8ba310b40e90015bd3ec3889af5ea13fe9705e3c29a235/68747470733a2f2f636f6465636f762e696f2f67682f6e616d656c697669612f6669746269742d687474702d7068702f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/namelivia/fitbit-http-php) [![StyleCI](https://camo.githubusercontent.com/c0b4d3fb12209bc851d6c7b4d2172dfdd1c5df0c28044a06709575871317a4c1/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3138383338333837372f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/188383877)
======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#fitbit-http-php----)

 [![Fitbit PHP SDK](https://user-images.githubusercontent.com/1571416/58320709-9675d700-7e1c-11e9-8a4f-c082d68a7499.png)](https://user-images.githubusercontent.com/1571416/58320709-9675d700-7e1c-11e9-8a4f-c082d68a7499.png)

Disclaimer
==========

[](#disclaimer)

This project is not maintained anymore and therefore it will be archived. I'm abandoning it because I don't own any Fitbit product anymore so I can't do testing, and as far as I know it is not being used by anyone else.

If you are interested in this project feel free to contact me.

About
-----

[](#about)

This is a package for acessing the [Fitbit official Web API](https://dev.fitbit.com/build/reference/web-api/) from your PHP language project. It is designed so you can easily query and retrieve all data hold on their platform from Activity Logs to Sleep or Heart Rate information.

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

[](#installation)

Require this package, with [Composer](https://getcomposer.org/), in the root directory of your project.

```
$ composer require namelivia/fitbit-http-php:~0.0.1
```

Getting started
---------------

[](#getting-started)

Before getting started retrieving date from the Fitbit Web API you first need to [register your application](https://dev.fitbit.com/apps/new) on their platfrom [dev.fitbit.com](https://dev.fitbit.com). Once you submit the form and your application has ben registred, they will provide you with some credentials you need on the next step. These credentials are:

- OAuth 2.0 Client ID
- Client Secret Also you will provide a callback URL is the URL the client will be redirected from the Fitbit Platfrom after authorizing your application to access their data.

### Proving credentials

[](#proving-credentials)

Now to get started you need to create an new instance of the API like this, note that four strings parameters are required to do so:

```
$api = new \Namelivia\Fitbit\Api\Api(
	'someClientId', #clientId
	'someClientSecret', #clientSecret
	'https://myapp.com/authorized', #redirectUrl
	'/tmp/token' #tokenPath
);
```

The first paramter is the **OAuth 2.0 Client ID** you got from the Fitbit platform, the second parameter is the **Client Secret** you got from the Fitbit platform too. The third parameter is your applications URL where the users are going to be directed to from the Fitbit authorization screen. And the fourth one is the path where the authorization tokens is going to be stored in order to be rememberd so the authorization screen does not happens everytime.

- clientId: Your application client Id.
- clientSecret: Your application client secret.
- redirectUrl: Your application redirect URL.
- tokenPath: Your token path.

### Authorizing

[](#authorizing)

Now that you have the api, you need to check if the application is alredy authorized by calling `isAuthorized`, if you have a valid token stored on the token path you provided before or you have already providen an authorization code the following won't be necessary. If the api is still unauthorized an authorization code needs to be requested from the authorization Url, this Url can be retrieved by calling the `getAuthUri` function. You can redirect your user to that external Uri and after Fitbit will redirect the user back to your app by making use of the return url provided with the code as a parameter. In this example the code from the Uri is manually typed by the user. Finally once the you have the authorization code the api must be providen with it by calling the `setAuthorizationCode` function.

```
if (!$api->isAuthorized()) {
	echo 'Go to: ' . $api->getAuthUri() . "\n";
	echo "Enter verification code: \n";
	$code = trim(fgets(STDIN, 1024));
	$api->setAuthorizationCode($code);
}
```

### Initializing

[](#initializing)

Finally the last step before making the actual requests is to initialize the api, you can check if the api is already initialized by calling `isInitialized` and initialize it by calling `initialize`. This will refresh or create tokens if needed and store them in the token path providen before. Now the api is ready to query data.

```
if (!$api->isInitialized()) {
	$api->initialize();
}
```

### Getting a fitbit instance

[](#getting-a-fitbit-instance)

For querying the data you need to get a fitbit instance, and for doing so you need to pass it the recently created an initialized api to the constructor like this:

```
$fitbit = new \Namelivia\Fitbit\Api\Fitbit($api);
```

### Retrieving data

[](#retrieving-data)

Everything is ready, you can start asking for the data.

```
$fitbit->activities()->favorites()->get();
```

For further information refer to the documentation linked in the next section.

Documentation
-------------

[](#documentation)

The full documentation can be found [in the wiki section of the github repository](https://github.com/namelivia/fitbit-http-php/wiki). Also you can refer to the [official Fitbit Web API documentation](https://dev.fitbit.com/build/reference/web-api/)

License
-------

[](#license)

[MIT](LICENSE)

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

[](#contributing)

Any suggestion, bug reports, prs or any other kind enhacements are welcome. Just [open an issue first](https://github.com/namelivia/fitbit-http-php/issues/new), for creating a PR remember this project has linting checkings and unit tests so any PR should comply with both before beign merged, this checks will be automatically applied when opening or modifying the PR's.

Local development
-----------------

[](#local-development)

This project comes with a `docker-compose.yml` file so if you use Docker and docker-compose you can develop without installing anything on your local environment. Just run `docker-compose up --build` for the first time to setup the container and launch the tests. PHPUnit is configured as the entrypoint so just run `docker-compose up` everytime you want the tests to execute on the Dockerized PHP development container.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 54.8% 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 ~53 days

Recently: every ~100 days

Total

15

Last Release

1740d ago

PHP version history (3 changes)0.0.1PHP ^7.1

0.0.13PHP ^7.3

0.0.15PHP ^7.3|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/e45383e493e5f750571f87d4d178acc257ff13691c99439453ec2a48c229848a?d=identicon)[namelivia](/maintainers/namelivia)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (57 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (35 commits)")[![namelivia](https://avatars.githubusercontent.com/u/1571416?v=4)](https://github.com/namelivia "namelivia (10 commits)")[![Olindn](https://avatars.githubusercontent.com/u/2814277?v=4)](https://github.com/Olindn "Olindn (1 commits)")[![TomasPilar](https://avatars.githubusercontent.com/u/8326937?v=4)](https://github.com/TomasPilar "TomasPilar (1 commits)")

---

Tags

apisdkfitbit

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/namelivia-fitbit-http-php/health.svg)

```
[![Health](https://phpackages.com/badges/namelivia-fitbit-http-php/health.svg)](https://phpackages.com/packages/namelivia-fitbit-http-php)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[hubspot/api-client

Hubspot API client

23414.2M16](/packages/hubspot-api-client)[mailchimp/transactional

458.9M16](/packages/mailchimp-transactional)[resend/resend-php

Resend PHP library.

564.7M21](/packages/resend-resend-php)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

553.3M7](/packages/checkout-checkout-sdk-php)[mozex/anthropic-laravel

Anthropic PHP for Laravel is a supercharged PHP API client that allows you to interact with the Anthropic API

71226.4k1](/packages/mozex-anthropic-laravel)

PHPackages © 2026

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