capeandbay/zingfit

A Laravel Package for ZingFit-enabled Projects.

0.1.7 2020-07-20 10:55 UTC

This package is auto-updated.

Last update: 2024-10-29 06:41:37 UTC


README

ZingFit

Latest Version on Packagist Total Downloads

ZingFit is a platform for Boutique Fitness Clubs with a RESTful API available to premium clients. This package will greatly assist a ZingFit client's Developer with Integration when used with Laravel 6 or 7!

This is a 3rd Party Package not Supported by ZingFit.

Table of Contents

Click to expand

- [Installation](#installation)

Installation

Note: Cape & Bay recomends PHP 7.3+ and Laravel/Eloquent 7.x

Installing CapeAndBay/ZingFit in a Laravel app

Install this package with composer:

$ composer require capeandbay/zingfit

The package will automatically register itself.

Now, to run this package's migrations, first publish the migrations into your app's migrations directory, by running the following command:

```
php artisan vendor:publish --tag="zingfit.migrations"
```

Finally, run the migrations:

```
php artisan migrate
```

You can optionally publish the config file with:

php artisan vendor:publish --provider="CapeAndBay\ZingFit\ZingFitServiceProvider" --tag="config"

This is the contents of the published config file:

return [
    'production_url' => 'https://api.zingfit.com',
    'sandbox_url' => 'https://api.zingfitlab.com',
    'client_id' => env('ZINGFIT_CLIENT_ID', '__CLIENT_ID__'),
    'client_secret' => env('ZINGFIT_CLIENT_SECRET', '__SECRET__'),
    'client_tenant_id' => env('ZINGFIT_TENANT_ID', '__TENANT__')
];

Note, you will need to add the env variables above to .env file.

Usage

Use via dependency injection

   use CapeAndBay\ZingFit\ZingFit;

   public function __construct(ZingFit $zingfit)
   {
       /*  ... code logic here ...*/
   }

On initialization, the ZingFit object will attempt to retrieve the latest non-expired access token. Otherwise it will attempt to ping ZingFit using the ENV variables referenced in the zingfit config.

Here's a demo of how you can use it: You can retrieve all of the Product Series for a Region's Club with the following:

    $zingFit->getAllSeriesForSite($region_id, $site_id)

Change log

7.20.2020 - First Draft.

Testing

None Available.

Security

If you discover any security related issues, please email developers@capeandbay.com instead of using the issue tracker.

Credits

License

license. Please see the license file for more information.