PHPackages                             supersaas/api-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. supersaas/api-client

ActiveLibrary[API Development](/categories/api)

supersaas/api-client
====================

Online bookings/appointments/calendars using the SuperSaaS scheduling platform. The SuperSaaS API provides services that can be used to add online booking and scheduling functionality to an existing website or CRM software.

2.0.0(2y ago)417.2k↓44.3%6MITPHPPHP &gt;=8.3

Since Mar 11Pushed 1y ago8 watchersCompare

[ Source](https://github.com/SuperSaaS/supersaas-php-api-client)[ Packagist](https://packagist.org/packages/supersaas/api-client)[ Docs](https://www.supersaas.com)[ RSS](/packages/supersaas-api-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (18)Used By (0)

SuperSaaS PHP SDK
=================

[](#supersaas-php-sdk)

Online bookings/appointments/calendars in PHP using the SuperSaaS scheduling platform -

The SuperSaaS API provides services that can be used to add online booking and scheduling functionality to an existing website or CRM software.

Prerequisites
-------------

[](#prerequisites)

1. [Register for a (free) SuperSaaS account](https://www.supersaas.com/accounts/new), and
2. get your account name and API key on the [Account Info](https://www.supersaas.com/accounts/edit) page.

##### Dependencies

[](#dependencies)

PHP 8.4 or greater.

No external libraries. Only the native `json_encode`/`json_decode` and `stream_context_create` standard calls are used.

Installation
------------

[](#installation)

1: Composer

The SuperSaaS PHP API Client is available from Packagist and can be included in your project via composer. Note, the supersaas-api-client may update major versions with breaking changes, so it's recommended to use a major version when expressing the package dependency. e.g.

```
$ composer require "supersaas/api-client:2.0.*"

```

In `composer.json`:

```
{
    "require": {
        "supersaas/supersaas-api-client": "^2"
    }
}

```

2: Manual

Download or checkout the project from github, and include the `src/SuperSaaS` folder manually.

Configuration
-------------

[](#configuration)

The `Client` can be used either (1) through the singleton helper method `Instance`, e.g.

```
SuperSaaS\Client::Instance(); //=> Client

```

And configured with authorization credentials using the `configure` method:

```
SuperSaaS\Client::configure('accountname', 'apikey');

```

Or else by (2) simply creating a new client instance and setting the properties manually, e.g.

```
$client = new Supersaas\Client();
$client->account_name = 'accountname';
$client->api_key = 'apikey';

```

> Note, ensure that `configure` is called before `Instance`, otherwise the client will be initialized with configuration defaults.

If the client isn't configured explicitly, it will use default `ENV` variables for the account name and api key.

Set these `ENV` variables before calling the client.

```
putenv("SSS_API_ACCOUNT_NAME=your-env-supersaas-account-name");
putenv("SSS_API_KEY=your-env-supersaas-account-api-key");
SuperSaaS\Client::Instance()->account_name; //=> 'your-env-supersaas-account-name'
SuperSaaS\Client::Instance()->api_key; //=> 'your-env-supersaas-account-api-key'

```

All configuration options can be individually set on the client.

```
SuperSaaS\Client::Instance()->api_key = 'xxxxxxxxxxxxxxxxxxxxxx';
SuperSaaS\Client::Instance()->verbose = TRUE;
...

```

API Methods
-----------

[](#api-methods)

Details of the data structures, parameters, and values can be found on the developer documentation site:

#### List Schedules

[](#list-schedules)

Get all account schedules:

```
SuperSaaS\Client::Instance()->schedules->getList(); //=> array(Schedule, ...)

```

#### List Resource

[](#list-resource)

Get all services/resources by `schedule_id`:

```
SuperSaaS\Client::Instance()->schedules->resources(12345); //=> array(Resource, ...)

```

*Note: does not work for capacity type schedules.*

#### List Fields of a Schedule

[](#list-fields-of-a-schedule)

Get all the available fields of a schedule by `schedule_id`:

```
SuperSaaS\Client::Instance()->schedules->fieldList(12345); //=> array(FieldList, ...)

```

#### Create User

[](#create-user)

Create a user with user attribute params `create($attributes, $user_id = null, $webhook = null, $duplicate = null)`. If `webhook=true` is present it will trigger any webhooks connected to the account. To avoid a ‘create’ action from being automatically interpreted as an ‘update’, you can add the parameter duplicate=raise, then error `422 Unprocessable Entity` will be raised. If in your database your user has id `1234` then you can supply a foreign key in format `1234fk` in `$user_id` (optional) which you can use to identify user: If validation fails for any field then error `422 Unprocessable Entity` will be raised and any additional information will be printed to your log. Data fields that you can supply can be found [here.](https://www.supersaas.com/info/dev/user_api):

```
SuperSaaS\Client::Instance()->users->create(array('name' => 'name@name.com', 'full_name' => 'Example Name', 'email' => 'example@example.com')); //=> https://www.supersaas.com/api/users/1234.json

```

#### Update User

[](#update-user)

Update a user with `$user_id` using user attribute params `update($user_id, $attributes, $webhook=null, $notFound=null)`. If `webhook=true` is present it will trigger any webhooks connected to the account. To avoid automatically creating a new record, you can add the parameter `notfound=error` or `notfound=ignore` to return a 404 Not Found or 200 OK respectively. If the `$user_id` does not exist 404 error will be raised. You only need to specify the attributes you wish to update:

```
SuperSaaS\Client::Instance()->users->update(12345, array('full_name' => 'New Name')); //=> array()

```

#### Delete User

[](#delete-user)

Delete a single user by `user_id`, and if `webhook=true` is present it will trigger any webhooks connected to the account:

```
SuperSaaS\Client::Instance()->users->delete(12345); //=> array()

```

#### Get User

[](#get-user)

Get a single user by `$user_id` with optional `$form`, and if the user does not exist 404 error will be raised:

```
SuperSaaS\Client::Instance()->users->get(12345); //=> User

```

#### List Users

[](#list-users)

Get all users with optional `$form` and `$limit`/`$offset` pagination params, `getList($form=null, $limit=null, $offset=null)`. User can have a form attached, and setting `form=true` shows the data:

```
SuperSaaS\Client::Instance()->users->getList(true, 25, 0); //=> array(User, ...)

```

#### List Fields of User object

[](#list-fields-of-user-object)

Get all the fields available to user object:

```
SuperSaaS\Client::Instance()->users->fieldList() //=> array(FieldList, ...)

```

#### Create Appointment/Booking

[](#create-appointmentbooking)

Create an appointment with `schedule_id`, and `user_id(optional)` (see API documentation on [create new](https://www.supersaas.com/info/dev/appointment_api#bookings_api)) appointment attributes and optional `form` and `webhook` params, `create($schedule_id, $attributes, $user_id, $form=null, $webhook=null)`:

```
SuperSaaS\Client::Instance()->appointments->create(12345, 67890, array('full_name' => 'Example Name', 'email' => 'example@example.com', 'slot_id' => 12345), TRUE, TRUE); //=> www.supersaas.com/api/bookings/34554.json

```

#### Update Appointment/Booking

[](#update-appointmentbooking)

Update an appointment by `schedule_id` and `appointment_id` with appointment attributes, see the above link, `update($schedule_id, $appointment_id, $attributes, $form=null, $webhook=null)`:

```
SuperSaaS\Client::Instance()->appointments->update(12345, 67890, array('full_name' => 'New Name')); //=> array()

```

#### Delete Appointment/Booking

[](#delete-appointmentbooking)

Delete a single appointment by `schedule_id` and `appointment_id`:

```
SuperSaaS\Client::Instance()->appointments->delete(12345, 67890); //=> array()

```

#### Get Appointment/Booking

[](#get-appointmentbooking)

Get a single appointment by `schedule_id` and `appointment_id`:

```
SuperSaaS\Client::Instance()->appointments->get(12345, 67890); //=> Appointment

```

#### List Appointments/Bookings

[](#list-appointmentsbookings)

List appointments by `schedule_id`, with `form` and `start_time` and `limit` view params, `getList($schedule_id, $form=null, $start_time=null, $limit=null)`:

```
SuperSaaS\Client::Instance()->appointments->getList(12345, 67890, TRUE, TRUE); //=> array(Appointment, ...)

```

#### Get Agenda

[](#get-agenda)

Get agenda (upcoming) appointments by `schedule_id` and `user_id`, with `from_time` view param ([see](https://www.supersaas.com/info/dev/appointment_api#agenda), `agenda($schedule_id, $user_id, $from_time = null, $slot=false)`:

```
SuperSaaS\Client::Instance()->appointments->agenda(schedule_id=12345, user_id=67890, form=TRUE, slot=FALSE); //=> array(Appointment, ...)

SuperSaaS\Client::Instance()->appointments->agenda(schedule_id=12345, user_id=67890, form=TRUE, slot=TRUE); //=> array(Slot, ...)

```

#### Get Available Appointments/Bookings

[](#get-available-appointmentsbookings)

Get available appointments by `schedule_id`, with `from` time and `length_minutes` and `resource` params ([see](https://www.supersaas.com/info/dev/appointment_api#availability_api), `available($schedule_id, $from_time = null, $length_minutes = null, $resource = null, $full = null, $limit = null)`:

```
SuperSaaS\Client::Instance()->appointments->available(schedule_id=12345, from='2018-01-31 00:00:00', length_minutes=15, resource='My Class'); //=> array(Appointment, ...)

```

#### Get Recent Changes

[](#get-recent-changes)

Get recently changed appointments by `schedule_id`, with `from` time, `to` time, `user` user, `slot` view params (see [docs](https://www.supersaas.com/info/dev/appointment_api#recent_changes)), `changes($schedule_id, $from_time = null, $to=null, $slot=false, $user=null, $limit=null, $offset=null)`:

```
SuperSaaS\Client::Instance()->appointments->changes(schedule_id=12345, from_time='2018-01-31 00:00:00', slot=FALSE); //=> array(Appointment, ...)

SuperSaaS\Client::Instance()->appointments->changes(schedule_id=12345, from_time='2018-01-31 00:00:00', slot=TRUE); //=> array(Slot, ...)

```

#### Get Recent Changes For Slots

[](#get-recent-changes-for-slots)

This method is deprecated and will be removed in the future. Get recently changed appointments for slots by `schedule_id`, with `from_time` time param (see [docs](https://www.supersaas.com/info/dev/appointment_api#recent_changes)), `changesSlots($schedule_id, $from_time = null)`:

```
SuperSaaS\Client::Instance()->appointments->changesSlots(schedule_id=12345, from_time='2018-01-31 00:00:00'); //=> array(Slot, ...)

```

#### Get Agenda Slots

[](#get-agenda-slots)

This method is deprecated and will be removed in the future. Get agenda (upcoming) slots by `schedule_id` and `user_id`, with `from_time` view param, `agendaSlots($schedule_id, $user_id, $from_time = null)`:

```
SuperSaaS\Client::Instance()->appointments->agendaSlots(12345, 67890, '2018-01-31 00:00:00') //=> array(Slot, ...)

```

*Note: only works for capacity type schedules.*

#### Get list of appointments

[](#get-list-of-appointments)

Get list of appointments by `schedule_id`, with `today`, `from time`, `to` time and `slot` view param (see updated range function), `listAppointments($schedule_id, $today = false, $from_time = null, $to = null, $slot = false)`:

```
SuperSaaS\Client::Instance()->appointments->listAppointments(schedule_id=12345, today=TRUE, from_time='2020-01-31 00:00:00',from_time='2020-02-01 00:00:00' slot=False) //=> array(Slot, ...)

```

#### Get range of appointments

[](#get-range-of-appointments)

This is the updated method to fetch range (see above list) of appointments. Get range of appointments by `schedule_id`, with `today`, `from` time, `to` time and `slot` view params (see [docs](https://www.supersaas.com/info/dev/appointment_api#range)), `range($scheduleId, $today = false, $fromTime = null, $to = null, $slot = false, $user = null, $resourceId = null, $serviceId = null, $limit = null, $offset = null)`:

```
SuperSaaS\Client::Instance()->appointments->range(12345, false, '2018-01-31 00:00:00', '2019-01-31 00:00:00', true) //=> array(Appointment, ...)

```

#### List Template Forms

[](#list-template-forms)

Get all forms by template `superform_id`, with `from_time`, and `user` params ([see](https://www.supersaas.com/info/dev/form_api)) and `limit`/`offset` pagination params:

```
SuperSaaS\Client::Instance()->forms->getList(12345, '2018-01-31 00:00:00'); //=> array(Form, ...)

```

#### Get Form

[](#get-form)

Get a single form by `form_id`, will raise 404 error if not found:

```
SuperSaaS\Client::Instance()->forms->get(12345); //=> Form

```

#### Get a list of SuperForms

[](#get-a-list-of-superforms)

Get a list of Form templates (SuperForms):

```
SuperSaaS\Client::Instance()->forms->forms() //=> array(SuperForm, ...)

```

#### List Groups in an account

[](#list-groups-in-an-account)

List Groups in an account ([see](https://www.supersaas.com/info/dev/information_api)):

```
SuperSaaS\Client::Instance()->groups->list() //=> array(Group, ...)

```

#### List Promotions

[](#list-promotions)

Get a list of promotional coupon codes with pagination parameters `limit` and `offset` (see [docs](https://www.supersaas.com/info/dev/promotion_api)), `list($limit = null, $offset = null)`:

```
SuperSaaS\Client::Instance()->promotions->list() //=> array(Promotion, ...)

```

#### Get a single coupon code

[](#get-a-single-coupon-code)

Retrieve information about a single coupon code use with `promotion_code`:

```
SuperSaaS\Client::Instance()->promotions->promotion((12345) //=> array(Promotion, ...)

```

#### Duplicate promotion code

[](#duplicate-promotion-code)

Duplicate a template promotion by giving (new) `promotion_code` and `template_code` in that order, `duplicatePromotionCode($promotionCode, $templateCode)`:

```
Supersaas::Client.instance.promotions.duplicatePromotionCode(12345, 94832838)

```

Examples
--------

[](#examples)

The ./examples folder contains several executable PHP scripts demonstrating how to use the API Client for common requests.

The examples will require your account name, api key, and some of the examples a schedule id and/or user id and/or form id. These can be set as environment variables. e.g.

```
$ export SSS_API_UID=myuserid SSS_API_SCHEDULE=myscheduleid SSS_API_ACCOUNT_NAME=myaccountname  SSS_API_KEY=myapikey && php -f ./examples/appointments.php
$ export SSS_API_FORM=myuserid SSS_API_ACCOUNT_NAME=myaccountname SSS_API_KEY=myapikey && php -f ./examples/forms.php
$ export SSS_API_ACCOUNT_NAME=myaccountname && export SSS_API_KEY=myapikey && php -f ./examples/users.php

```

Testing
-------

[](#testing)

The HTTP requests can be stubbed by configuring the client with the `dry_run` option, e.g.

```
SuperSaaS\Client::Instance()->dry_run = TRUE;

```

Note, stubbed requests always return an empty array.

The `Client` also provides a `last_request` attribute containing the http array object from the last performed request, e.g.

```
SuperSaaS\Client::Instance()->last_request; //=> array('method' => ..., 'header' => ..., 'content' => ...)

```

The headers, body, etc. of the last request can be inspected for assertion in tests, or for troubleshooting failed API requests.

For additional troubleshooting, the client can be configured with the `verbose` option, which will `puts` any JSON contents in the request and response, e.g.

```
SuperSaaS\Client::Instance()->verbose = TRUE;

```

Run internal unit tests (phpunit)
---------------------------------

[](#run-internal-unit-tests-phpunit)

```
./vendor/bin/phpunit # Runs all
./vendor/bin/phpunit --filter AppointmentsUnitTest # Run selection

```

Additional Information
----------------------

[](#additional-information)

- [SuperSaaS Registration](https://www.supersaas.com/accounts/new)
- [Product Documentation](https://www.supersaas.com/info/support)
- [Developer Documentation](https://www.supersaas.com/info/dev)
- [Python API Client](https://github.com/SuperSaaS/supersaas-python-api-client)
- [Ruby API Client](https://github.com/SuperSaaS/supersaas-ruby-api-client)
- [NodeJS API Client](https://github.com/SuperSaaS/supersaas-nodejs-api-client)

Contact:

Releases
--------

[](#releases)

The package follows [semantic versioning](https://semver.org/), i.e. MAJOR.MINOR.PATCH

License
-------

[](#license)

The SuperSaaS PHP API Client is available under the MIT license. See the LICENSE file for more info.

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity87

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 62.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~155 days

Recently: every ~370 days

Total

15

Last Release

817d ago

Major Versions

0.10.3 → 1.0.02019-02-27

1.1.3 → 2.0.02024-02-21

PHP version history (2 changes)0.9.0PHP &gt;=5.3

2.0.0PHP &gt;=8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6318768?v=4)[SuperSaaS](/maintainers/SuperSaaS)[@SuperSaaS](https://github.com/SuperSaaS)

---

Top Contributors

[![TertiumQuid](https://avatars.githubusercontent.com/u/26169?v=4)](https://github.com/TertiumQuid "TertiumQuid (18 commits)")[![zubfatal](https://avatars.githubusercontent.com/u/10694500?v=4)](https://github.com/zubfatal "zubfatal (5 commits)")[![betorina](https://avatars.githubusercontent.com/u/3939796?v=4)](https://github.com/betorina "betorina (2 commits)")[![FistOfTheNorthStar](https://avatars.githubusercontent.com/u/13538400?v=4)](https://github.com/FistOfTheNorthStar "FistOfTheNorthStar (2 commits)")[![Fjan](https://avatars.githubusercontent.com/u/85734?v=4)](https://github.com/Fjan "Fjan (1 commits)")[![intco](https://avatars.githubusercontent.com/u/1218999?v=4)](https://github.com/intco "intco (1 commits)")

---

Tags

scheduling systemonline appointment schedulebooking calendarappointment bookreservation systemscheduling softwareonline booking systembusiness calendarsupersaas

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/supersaas-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/supersaas-api-client/health.svg)](https://phpackages.com/packages/supersaas-api-client)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
