Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

nlocascio/mindbody-laravel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel MINDBODY

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'        => '[email protected]'
]);