nlocascio/mindbody-laravel

This package is abandoned and no longer maintained. No replacement package was suggested.

Laravel wrapper for MINDBODY API

v0.3.7 2017-09-04 23:56 UTC

README

Access the MINDBODY API from your Laravel application.

Latest Stable Version Packagist Downloads Software License Build Status

Requirements

This package requires:

  • PHP 7.0+
  • Laravel 5.1+

You will also need the following credentials to access the MINDBODY API:

  • SourceCredentials consisting of your SourceName and Password
  • Site ID (or multiple Site IDs) corresponding to the MINDBODY site(s) you are connecting to

For API credentials and documentation, visit the MINDBODY Developers site.

Installation

Install the package through Composer:

composer require nlocascio/mindbody-laravel

Registering the Service Provider

Append the service provider to the providers key in config/app.php:

Nlocascio\Mindbody\MindbodyServiceProvider::class

Configuring API Credentials

Configure your API credentials by defining the following environment variables in .env:

MINDBODY_SOURCENAME=                // Your Source Name
MINDBODY_SOURCEPASSWORD=            // Your Source Password
MINDBODY_SITEIDS=                   // Site ID. (Also accepts a comma-delimitted list of IDs)

Usage

Option 1: Type-hinting

You may type-hint the Mindbody class in methods of classes which are resolved by the service container:

public function index(Mindbody $mindbody)
{
    $response = $mindbody->GetClients();
}

Option 2: Use Laravel's helper method

use Nlocascio\Mindbody\Mindbody;

public function index()
{
    $mindbody = resolve(Mindbody::class);
    
    $mindbody->GetClients();
}

Running API functions

Examples:

$mindbody = resolve(Mindbody::class);

$result = $mindbody->GetSites();

With arguments:

$mindbody = resolve(Mindbody::class);

$result = $mindbody->GetClients([
    'XMLDetail'         => 'Bare',
    'Fields'            => [
                                'Clients.FirstName',
                                'Clients.LastName'
                            ],
    'PageSize'          => 500,
    'CurrentPageIndex'  => 1,
    'SearchText'        => 'example@email.com'
]);