lionsmantle/supportboard-client

A PHP library providing an abstraction layer for SupportBoard PHP functions, designed for WordPress plugin integration

dev-main 2025-07-12 03:28 UTC

This package is auto-updated.

Last update: 2025-07-12 03:35:33 UTC


README

A PHP library providing an abstraction layer for SupportBoard PHP functions, designed for WordPress plugin integration.

Features

  • Clean OOP Interface: Wraps SupportBoard's function-based API in service classes
  • WordPress Integration: Designed specifically for WordPress plugin development
  • Comprehensive Testing: Unit and integration tests with mocking capabilities
  • Error Handling: Standardized responses and exception hierarchy
  • Type Safety: Full type hints and return type declarations

Requirements

  • PHP 7.4 or higher
  • WordPress 5.0 or higher
  • SupportBoard 3.8.2 or compatible

Installation

composer require lionsmantle/supportboard-client

Quick Start

use LionsMantle\SupportBoardClient\SupportBoardClient;

// Initialize the client
$client = new SupportBoardClient();

// Get user by ID
$userService = $client->users();
$response = $userService->getUser(123);

if ($response->success) {
    $user = $response->data;
    echo "User: " . $user['first_name'] . ' ' . $user['last_name'];
} else {
    echo "Error: " . $response->error;
}

// Get user by email (new!)
$response = $userService->getUserByEmail('john@example.com');
if ($response->success) {
    $user = $response->data;
    echo "Found user: " . $user['email'];
}

Services

  • UserService: User management (get by ID/email, create, authenticate)
  • ConversationService: Conversation handling
  • MessageService: Message operations
  • AdminService: Admin and agent functions
  • SettingsService: Configuration management
  • DatabaseService: Database operations
  • LanguageService: Translation functions

Testing

# Run all tests
composer test

# Run unit tests only
composer test:unit

# Run with coverage
composer test:coverage

Code Quality

# Check coding standards
composer lint

# Fix coding standards
composer lint:fix

# Run static analysis
composer analyze

License

MIT License. See LICENSE file for details.

Contributing

Please see CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.