techgyani / garmin-wellness
为 garmin-wellness API 的非官方 Oauth 1.0 适配器
0.1.3
2016-12-15 06:15 UTC
Requires
- php: >=5.4.0
- league/oauth1-client: ~1.2
This package is not auto-updated.
Last update: 2024-09-14 19:58:33 UTC
README
本包提供了一个用于 PHP League 的 OAuth 1.0 客户端 的 Garmin API 客户端。
安装
composer require techgyani/garmin-wellness
用法
用法与 The League 的 OAuth 客户端相同,使用 techgyani\OAuth1\Client\Server\Garmin
作为提供者。
$server = new techgyani\OAuth1\Client\Server\Garmin([ 'identifier' => 'your-client-id', 'secret' => 'your-client-secret', 'callback_uri' => 'http://callback.url/callback', ]);
请参阅 Garmin wellness API 了解可用的端点。
以下是测试示例的步骤:
1. Copy examples in your web-server root if needed.
2. Define consumerKey, consumerSecret and callback_uri enviornment variables or alternatively set them directly in all php files in example. Below is the .htaccess code to demonstrate how you may do it.
setEnv consumerKey sddsadas
setEnv consumerSecret fdsfdsfsd
setEnv callback_uri https://127.0.0.1/garmin-wellness/vendor/techgyani/garmin-wellness/examples/garmin_callback.php
3. Now run examples/index.php in your browser. It should redirect you to the garmin server, where you need to login and authorize the application.
4. Once authorization is done user will be redirected to examples/garmin_api_test.php. There you must see activity summary output if everything is okay.
5. You can change parameter values in examples/garmin_api_test.php because it is picking up user token from the session.