Package Data | |
---|---|
Maintainer Username: | jsamos |
Maintainer Contact: | jsamos@gmail.com (Juni Samos) |
Package Create Date: | 2013-12-11 |
Package Last Update: | 2015-03-24 |
Language: | PHP |
License: | Apache-2.0 |
Last Refreshed: | 2024-12-19 03:13:30 |
Package Statistics | |
---|---|
Total Downloads: | 79 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 3 |
Total Forks: | 2 |
Total Open Issues: | 3 |
Laravel 4 Wrapper for fitbitphp package
composer.json
{
"require": {
"slender/auth": "dev-master"
}
}
add service provider and facade to app/config/app.php
'providers' => array(
...
'Jsamos\Lafitbit\LafitbitServiceProvider',
...
);
...
'aliases' => array(
...
'Fitbit' => 'Jsamos\Lafitbit\Facades\Fitbit',
...
);
Each of the ApiGateways in the parent project are available through static methods
e.g. $factory->getUserGateway becomes Fitbit::user()
class FitbitController extends Controller {
public function oauth()
{
$auth = Fitbit::authentication();
$auth->initiateLogin();
}
public function authenticate()
{
$auth = Fitbit::authentication();
$oauth_token = Input::get('oauth_token');
$oauth_verifier = Input::get('oauth_verifier');
$auth->authenticateUser($oauth_token, $oauth_verifier);
if ($auth->isAuthorized()) {
$profile = Fitbit::user()->getProfile();
var_dump($profile);
} else {
echo 'Not connected.';
}
}
}