acuityscheduling/acuityscheduling

Acuity Scheduling PHP SDK. Examples and a standard library for Acuity Scheduling integration.

0.1.9 2017-01-31 17:59 UTC

README

Welcome to the Acuity Scheduling PHP SDK. This SDK provides examples and a standard library for integrating with the Acuity Scheduling API using PHP. You can learn more about developing for Acuity Scheduling at developers.acuityscheduling.com.

Installation

This package can be installed with composer or added to your application manually. To install with composer, first execute in a shell:

$ composer require acuityscheduling/acuityscheduling

Then include the vendor/autoload.php in your app.

<?php
require_once('vendor/autoload.php');

If you're installing manually, simply include the AcuityScheduling.php file in your app.

Hello World

Here's a basic example to get started. Just set your API credentials and run:

<?php
require_once('vendor/autoload.php');

$userId = null;
$apiKey = null;

$acuity = new AcuityScheduling(array(
  'userId' => $userId,
  'apiKey' => $apiKey
));

$appointments = $acuity->request('/appointments');
print_r($appointments);

Examples

You'll find several examples of different Acuity integrations in the examples/ directory. These examples cover:

Sample examples/config.json

Create a config file with your API credentials to get started. All examples share a common config file containing your Acuity userId and apiKey for basic API access and verifying callbacks. OAuth2 examples require additional OAuth2 client account credentials.

{
	"userId": 1,
	"apiKey": "abc123"
}

Basic API Access

examples/basic/ is a basic API integration for a single account.

Start the example server by doing php -S localhost:8000 -t examples/basic and navigate to 127.0.0.1:8000

Create an Appointment

examples/create-appointment/ is a more advanced API example for scheduling an appointment. In this example, you'll see how to:

  • fetch appoinment types
  • find an available date and time
  • create the appointment

Start the example server by doing php -S localhost:8000 -t examples/create-appointment and navigate to 127.0.0.1:8000

OAuth2 API Access

examples/oauth2/ is an OAuth2 API integration. Use this to get connected with multiple Acuity accounts.

Create a config file with your OAuth2 credentials to get started. If you don't have OAuth2 credentials, please fill out this registration form. Start the example server by doing php -S localhost:8000 -t examples/oauth2 and navigate to 127.0.0.1:8000

Sample examples/config.json
{
	"clientId": "N4HgVZbjHVp3HAkR",
	"clientSecret": "H33vYz88sEiKVbl7EMob1URDrqZrvceSCMmZJpAi",
	"redirectUri": "http://127.0.0.1:8000/oauth2"
}

Webhooks

examples/webhooks/ is a sample webhook integration.

Start the example server by doing php -S localhost:8000 -t examples/webhooks and navigate to 127.0.0.1:8000

Custom Sidebar

examples/custom-sidebar/ allows you to display custom information in the appointment details sidebar.

Start the example server by doing php -S localhost:8000 -t examples/custom-sidebar and navigate to 127.0.0.1:8000