PHP code example of namelivia / laravel-fitbit

1. Go to this page and download the library: Download namelivia/laravel-fitbit library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

namelivia / laravel-fitbit example snippets


Namelivia\Fitbit\Laravel\FitbitServiceProvider::class

'Fitbit' => Namelivia\Fitbit\Laravel\Facades\Fitbit::class

// You can alias this in config/app.php.
use Namelivia\Fitbit\Laravel\Facades\Fitbit;

Fitbit::activities()->activity()->getLifetimeStats();
// We're done here - how easy was that, it just works!

use Namelivia\Fitbit\Laravel\Facades\Fitbit;

// Writing this…
Fitbit::connection('main')->activities()->activity()->getLifetimeStats();

// …is identical to writing this
Fitbit::activities()->activity()->getLifetimeStats();

// and is also identical to writing this.
Fitbit::connection()->activities()->activity()->getLifetimeStats();

// This is because the main connection is configured to be the default.
Fitbit::getDefaultConnection(); // This will return main.

// We can change the default connection.
Fitbit::setDefaultConnection('alternative'); // The default is now alternative.

use Namelivia\Fitbit\Laravel\FitbitManager;

class Foo
{
    protected $fitbit;

    public function __construct(FitbitManager $fitbit)
    {
        $this->fitbit = $fitbit;
    }

    public function bar()
    {
        $this->fitbit->activities()->activity()->getLifetimeStats();
    }
}

App::make('Foo')->bar();
bash
$ php artisan vendor:publish --provider="Namelivia\Fitbit\Laravel\FitbitServiceProvider"