Download the PHP package deniztezcan/laravel-strava without Composer

On this page you can find all versions of the php package deniztezcan/laravel-strava. 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 laravel-strava

Laravel Strava Package

A laravel package to access data from the Strava API. Compatible with and above. Forked from @RichieMcMullen due to his package not being able to be used on Laravel 8.

Table of Contents

Strava Access Credentials

In order to use this package you will need to create an app from within your strava account. Create Strava App to access your API credentials. Click here for more information on the Strava API.

Installation

To install the package within your laravel project use the following composer command:

Publish Strava Config File

The vendor:publish commmand will publish a file named strava.php within your laravel project config folder config/strava.php. Edit this file with your Strava API credentials, generated from the Strava app you created.

Published Config File Contents

Alternatively you can ignore the above publish command and add this following variables to your .env file. Make sure to add your Strava App credentials

Auto Discovery

If you're using Laravel 5.5+ you don't need to manually add the service provider or facade. This will be Auto-Discovered. For all versions of Laravel below 5.5, you must manually add the ServiceProvider & Facade to the appropriate arrays within your Laravel project config/app.php

Provider

Alias / Facade

Usage

Use Strava Facade

Add the Strava facade to the top of your controller so you can access the Strava class methods.

Authenticate User

Call the Strava::authenticate() method to redirect you to Strava. If authentication is successful the user will be redirected to the redirect_uri that you added to the config file or your .env file. You may now also pass as a parameter when authenticating. You can add or remove scopes as required. Some are required, some are optional. Details on available scopes can be seen here Strava Authentication Scopes

Obtain User Access Token

When returned to the redirected uri, call the Strava::token($code) method to generate the users Strava access token & refresh token. The tokens are generated using the code parameter value within the redirected uri. Be sure to store the users access_token & refresh_token in your database.

Example Response

At this point you have access to the Athlete object that can be used to login to your website. Of course you'll need to write the logic for your login system, but the athlete name, email etc.. is contained within the object for you to verify the user against your own database data.

Access Token Expiry

Access tokens will now expire after 6 hours under the new flow that Strava have implemented and will need to be updated using a refresh token. In the example above you can see the response has a refresh_token and an expires_at field. When storing the user access tokens you may also want to store the expires_at field too. This will allow you to check when the current access token has expired.

When calling any of the Strava methods below you may want to compare the current time against the expires_at field in order to validate the token. If the token is expired you'll need to call the Strava::refreshToken($refreshToken) method in order to generate a new tokens. All you need to do is pass the users currently stored refresh_token, the method will then return a new set of tokens (access & refresh), update the current users tokens with the new tokens from the response. Heres an example of how that might work, using the Strava::athlete($token) method.

Unauthenticate User

You can allow users to unauthenticate their Strava account with your Strava app. Simply allow users to call the following method, passing the access token that has been stored for their account.

Available Methods

All methods require an access token, some methods accept additional optional parameters listed below.

Athlete Data

Returns the currently authenticated athlete.

User Activities Data

Returns the activities of an athlete.

User Single Activity

Returns the given activity that is owned by the authenticated athlete.

User Single Activity Stream

Returns the given activity's streams.

Activity Comments

Returns the comments on the given activity.

Activity Kudos

Returns the athletes who kudoed an activity.

Activity Laps

Returns the laps data of an activity.

Activity Zones

Summit Feature Required. Returns the zones of a given activity.

Athlete Zones

Returns the the authenticated athlete's heart rate and power zones.

Athlete Stats

Returns the activity stats of an athlete.

Club

Returns a given club using its identifier.

Club Members

Returns a list of the athletes who are members of a given club.

Club Activities

Retrieve recent activities from members of a specific club. The authenticated athlete must belong to the requested club in order to hit this endpoint. Pagination is supported. Athlete profile visibility is respected for all activities.

Club Admins

Returns a list of the administrators of a given club.

Athlete Clubs

Returns a list of the clubs whose membership includes the authenticated athlete.

Gear

Returns equipment data using gear ID.

Route

Returns a route using its route ID.

Athlete Routes

Returns a list of the routes created by the authenticated athlete using their athlete ID.

Segment

Returns the specified segment.

Segment Effort

Returns a segment effort from an activity that is owned by the authenticated athlete.

Starred Segments

List of the authenticated athlete's starred segments.

Parameter Types

Caching

It's highly recommended that you cache your requests made to Strava for 2 reasons.

(1) Rate Limiting

Strava have quite a good API Rate Limit, 600 requests every 15 minutes, 30,000 daily. If your website has high traffic you might want to consider caching your Strava response data so you don't exceed these limits.

(2) Website Loading Speed

Caching your Strava data will drastically improve website load times.

Useful Links


All versions of laravel-strava with dependencies

PHP Build Version
Package Version
Requires guzzlehttp/guzzle Version ^6.3|^7.0
illuminate/support Version 5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.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 deniztezcan/laravel-strava contains the following files

Loading the files please wait ....