Download the PHP package namelivia/fitbit-http-php without Composer

On this page you can find all versions of the php package namelivia/fitbit-http-php. 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 fitbit-http-php

fitbit-http-php tag Build Status codecov StyleCI

Fitbit PHP SDK

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

This is a package for acessing the Fitbit official 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

Require this package, with Composer, in the root directory of your project.

Getting started

Before getting started retrieving date from the Fitbit Web API you first need to register your application on their platfrom 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:

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:

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.

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.

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.

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:

Retrieving data

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

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

Documentation

The full documentation can be found in the wiki section of the github repository. Also you can refer to the official Fitbit Web API documentation

License

MIT

Contributing

Any suggestion, bug reports, prs or any other kind enhacements are welcome. Just open an issue first, 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

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.


All versions of fitbit-http-php with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8.0
guzzlehttp/guzzle Version ^7.0.1
kamermans/guzzle-oauth2-subscriber Version ^1.0
nesbot/carbon Version ^2.0
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 namelivia/fitbit-http-php contains the following files

Loading the files please wait ....