Guide
  • SDK

    • PHP
    • .NET
  • Postman

    • Postman Collection
Api Docs
Guide
  • SDK

    • PHP
    • .NET
  • Postman

    • Postman Collection
Api Docs
  • Getting Started

    • Getting Started
    • Integration process
  • Tools and libraries

    • SDK for PHP
    • SDK for .NET
    • Postman Collection
  • Fundamentals

    • Authorization
    • Errors
    • Extensions
    • Rate Limits
  • API Objects

    • Resources
    • Managing calendars
    • Online Features
    • Patient Presence
  • Callbacks

    • Push vs Pull
    • Real-time requests
  • Mappings

    • Vendor mapping
  • Changelog

    • Changelog
DOCPLANNER INTEGRATIONS

SDK for PHP

Our PHP SDK provides a comprehensive implementation of all available models and methods, enabling quick and seamless integration with the Docplanner API. Find all the information you need to get started below.

Installation

Repository

You can find the PHP SDK in our public GitHub repository: https://github.com/DocPlanner/integrations-api-sdk-php

Composer

To install the SDK via Composer, run:

composer require docplanner/integrations-api-sdk-php

Manual Installation

Download the files from the repository and include the autoload.php file in your project:

require_once('/path/to/DocPlanner/Client/vendor/autoload.php');

Authorization

To access the API, you must request an access token from:

https://www.{domain}/oauth/v2/token

using your client credentials (client_id and client_secret). The Docplanner SDK uses OAuth2 with grant_type = client_credentials and scope = integration.

The access token is valid for 24 hours, so it is recommended to cache and reuse it during that period to avoid unnecessary requests.

You can obtain and configure the token in your application as follows:

// Get OAuth2 access token
$authorization = new DocPlanner\Client\Authorization('https://www.{domain}/oauth/v2/token');
$accessToken = $authorization->getAccessToken('YOUR_CLIENT_ID', 'YOUR_CLIENT_SECRET');

// Configure access token for authorization 
$config = DocPlanner\Client\Configuration::getDefaultConfiguration()->setAccessToken($accessToken);
$apiInstance = new DocPlanner\Client\Api\AddressesApi(null, $config);

Example Usage

Below is a sample illustrating typical usage of the PHP SDK:

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

// Get OAuth2 access token
$authorization = new DocPlanner\Client\Authorization('https://www.{domain}/oauth/v2/token');
$accessToken = $authorization->getAccessToken('YOUR_CLIENT_ID', 'YOUR_CLIENT_SECRET');

// Configure access token for authorization 
$config = DocPlanner\Client\Configuration::getDefaultConfiguration();
$config->setAccessToken($accessToken);
$config->setHost('https://www.{domain}/api/v3/integration');

// Instantiate the Doctors API client
$doctorsApiInstance = new DocPlanner\Client\Api\DoctorsApi(
    // Optionally, you can pass a custom HTTP client implementing `GuzzleHttp\ClientInterface`.
    new GuzzleHttp\Client(),
    $config
);

$facilityId = 56; // int | Facility ID
$with = array(\DocPlanner\Client\Model\DoctorsScopes::SPECIALIZATIONS); // array of scopes

try {
    $result = $doctorsApiInstance->getDoctors($facilityId, $with);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DoctorsApi->getDoctors: ', $e->getMessage(), PHP_EOL;
}

// Instantiate the Addresses API client
$addressesApiInstance = new DocPlanner\Client\Api\AddressesApi(
    new GuzzleHttp\Client(),
    $config
);

$doctorId = 56; // int | Doctor ID

try {
    $result = $addressesApiInstance->getAddresses($facilityId, $doctorId);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AddressesApi->getAddresses: ', $e->getMessage(), PHP_EOL;
}
?>
Next
SDK for .NET