nlocascio / mindbody-laravel
Laravel wrapper for MINDBODY API
Installs: 16 605
Dependents: 1
Suggesters: 0
Security: 0
Stars: 4
Watchers: 2
Forks: 4
Open Issues: 2
pkg:composer/nlocascio/mindbody-laravel
Requires
- php: ^7.0
- illuminate/support: >=5.1
Requires (Dev)
- orchestra/testbench: ~3.0
- phpunit/phpunit: ^5.4
- vlucas/phpdotenv: ^2.4
README
Access the MINDBODY API from your Laravel application.
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' ]);