Access the MINDBODY API from your Laravel application.
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.
Install the package through Composer:
composer require nlocascio/mindbody-laravel
Append the service provider to the providers
key in config/app.php
:
Nlocascio\Mindbody\MindbodyServiceProvider::class
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)
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();
}
use Nlocascio\Mindbody\Mindbody;
public function index()
{
$mindbody = resolve(Mindbody::class);
$mindbody->GetClients();
}
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]'
]);