Skip to content

Latest commit

 

History

120 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WellnessLiving PHP SDK

Auto-generated PHP SDK for the WellnessLiving API, built from the OpenAPI specification.

Each API endpoint is a dedicated PHP class with typed public properties for request parameters and one method per HTTP verb (get(), post(), etc.).

Channels

Channel Spec Branch Description
production production/openapi.yaml main Dedicated production API channel.
stable stable/openapi.yaml stable Follows the live WellnessLiving platform.
dev dev/openapi.yaml dev Latest features; may include breaking changes.

Structure

All three branches share the same layout — src/ at the root with a composer.json pointing to it. The main branch additionally contains the generator under scripts/.

src/                  - generated SDK classes (production channel on main)
    WlSdkClient.php
    WlSdkException.php
    WlSdkInfo.php
    Core/Request/ExampleApi.php
    Wl/Appointment/BookApi.php
    ...
scripts/              - SDK generator (main branch only, not part of the package)

Requirements

  • PHP 7.4 or later
  • ext-curl
  • ext-json

Installation

Each channel is a separate Composer package served from a dedicated branch in this repository. Add the VCS source once per project, then require the channel you need.

# Add source once
composer config repositories.wl-sdk vcs https://github.com/wellnessliving/wl-openapi-php
Channel Package Branch When to use
production wellnessliving/wl-openapi-php main Production API - default for live apps
stable wellnessliving/wl-openapi-php-stable stable Tracks the live platform
dev wellnessliving/wl-openapi-php-dev dev Feature development - latest endpoints
# Development - use dev channel
composer require wellnessliving/wl-openapi-php-dev

# Stabilizing / QA - switch to stable
composer remove wellnessliving/wl-openapi-php-dev
composer require wellnessliving/wl-openapi-php-stable

# Deploy to production environment - switch to production channel
composer remove wellnessliving/wl-openapi-php-stable
composer require wellnessliving/wl-openapi-php

The namespace WlSdk\ is identical across all channels - switching channels requires no code changes, only a composer command.

From source (generator)

git clone https://github.com/wellnessliving/wl-openapi-php.git
cd wl-openapi-php
composer install

Usage

use WlSdk\WlSdkClient;
use WlSdk\Core\Request\ExampleApi;

$client = new WlSdkClient(['token' => 'YOUR_JWT_TOKEN']);

$api = new ExampleApi($client);
$api->i_argument = 1;
$result = $api->get();

echo $result->i_result; // 2

Constructor options

Option Type Default Description
token string|null null JWT Bearer token for authentication.
base_url string https://staging.wellnessliving.com API server base URL. Use https://demo.wellnessliving.com for the Australia data center.
timeout int 30 Request timeout in seconds.

Error handling

On a non-2xx HTTP response a WlSdkException is thrown. It exposes:

  • ->getCode() - HTTP status code.
  • ->data - parsed JSON response body (array|null).
use WlSdk\WlSdkException;
use WlSdk\Wl\User\Login\EmailApi;

$api = new EmailApi($client);
$api->text_email = 'user@example.com';
$api->text_password = 'secret';

try {
    $result = $api->post();
} catch (WlSdkException $e) {
    echo 'HTTP ' . $e->getCode() . ': ' . $e->getMessage();
    var_dump($e->data);
}

Pinning a specific version

Each channel release tags the spec version (e.g. stable-1.1.20260619090040). To pin:

composer require wellnessliving/wl-openapi-php:"1.1.20260619090040"

Regenerating the SDK locally

composer install
composer run generate               # regenerate stable, dev, and production
composer run generate:stable        # regenerate stable only
composer run generate:dev           # regenerate dev only
composer run generate:production    # regenerate production only

Automation

GitHub Actions checks for upstream spec changes daily at 08:00 UTC. When a channel's spec version changes, it commits the updated files and creates a separate GitHub Release for that channel:

Channel Tag format Release type
production production-VERSION Latest release
stable stable-VERSION Pre-release
dev dev-VERSION Release

Each release contains only the zip for its channel (wl-openapi-php-{channel}.zip). Channels that did not change in a given run do not produce a new release.

Automation setup

To trigger automatic rebuilds when the OpenAPI spec changes, see docs/notify-setup.md.

Resources

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages