PHPackages                             upmind/sdk - 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. upmind/sdk

ActiveLibrary[API Development](/categories/api)

upmind/sdk
==========

PHP SDK for the Upmind API

v1.1.0(8mo ago)26.4k↓32%1[2 issues](https://github.com/upmind/sdk-php/issues)GPL-3.0-onlyPHPPHP 7.4.\* | 8.0.\* | 8.1.\* | 8.2.\* | 8.3.\* | 8.4.\*CI passing

Since Jul 24Pushed 8mo ago5 watchersCompare

[ Source](https://github.com/upmind/sdk-php)[ Packagist](https://packagist.org/packages/upmind/sdk)[ RSS](/packages/upmind-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (9)Versions (6)Used By (0)

[Upmind](https://github.com/upmind-automation) - SDK
====================================================

[](#upmind---sdk)

[![Latest Version on Packagist](https://camo.githubusercontent.com/563a42883b4a27752025d6c72efa08240647a93f45dddaa8ae86b25f40066742/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f75706d696e642f73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/upmind/sdk)

This SDK can be used to streamline PHP integrations with the Upmind API.

- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
    - [Getting Started](#getting-started)
    - [Exceptions](#exceptions)
    - [Pagination](#pagination)
    - [Relations](#relations)
    - [Creating Resources](#creating-resources)
    - [Manual Usage](#manual-usage)
- [Changelog](#changelog)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)
- [Upmind](#upmind)

Requirements
------------

[](#requirements)

- PHP 7.4, 8.0, 8.1, 8.2, 8.3 or 8.4
- Composer
- [HTTPlug-compatible Client](https://packagist.org/providers/psr/http-client-implementation) e.g., Guzzle
- [Upmind Starter](https://upmind.com/pricing) plan or higher

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

[](#installation)

```
composer require upmind/sdk
```

This library makes use of the [HTTPLUG](https://docs.php-http.org/en/latest/index.html) abstraction for making HTTP requests, using [discovery](https://docs.php-http.org/en/latest/discovery.html) to automatically detect an HTTP client to use. Because the library depends on the virtual package `psr/http-client-implementation` you will need to first install a compatible HTTP [client implementation](https://packagist.org/providers/psr/http-client-implementation) e.g., [php-http/guzzle7-adapter](https://packagist.org/packages/php-http/guzzle7-adapter).

It's possible to use any implementations of the following PSRs:

- [PSR-18 HTTP Client](https://www.php-fig.org/psr/psr-18/)
- [PSR-17 HTTP Factory](https://www.php-fig.org/psr/psr-17/)
- [PSR-3 Logger](https://www.php-fig.org/psr/psr-3/)

Usage
-----

[](#usage)

### Getting Started

[](#getting-started)

To use the SDK you will need to first create an API token in your Upmind admin area settings. You should also make note of your brand ID.

First you will need to create a `Config` instance with your API token and brand ID. Then, use that to create an instance of the `Api` client. Set the `debug` option to `true` to stream API requests and responses to STDERR; alternatively you can pass an alternative PSR-3 compliant logger when instantiating the API.

You can then get an instance of a service to start making API requests.

```
use Upmind\Sdk\Api;
use Upmind\Sdk\Config;

$config = new Config(
    token: 'your-api-token',
    brandId: 'your-brand-id',
    withoutNotifications: true, // don't trigger notifications for create/update/delete requests
    debug: true, // stream api requests + responses to STDERR by default
);
$api = new Api($config);
$service = $api->clientService();

$clientId = '467029e9-d574-1484-680f-e10683283ed5';

$response = $service->getClient($clientId);
$clientData = $response->getResponseData();
// ...
```

### Exceptions

[](#exceptions)

All exceptions thrown by this library implement the marker interface `Upmind\Sdk\Exceptions\UpmindSdkException`.

By default, API error (non-2xx) responses will throw an instance of `Upmind\Sdk\Exceptions\HttpException` which contains the API error response data. You can turn off HttpExceptions by instantiating `Config` with `restfulExceptions: false`,

#### HTTP Exceptions Enabled

[](#http-exceptions-enabled)

With HTTP exceptions enabled (default), there is no need to inspect the HTTP code or response body to detect errors, as the SDK will throw an exception for any non-2xx HTTP response.

```
use Upmind\Sdk\Api;
use Upmind\Sdk\Config;
use Upmind\Sdk\Exceptions\HttpException;
use Upmind\Sdk\Exceptions\ValidationException;

$config = new Config(
    token: 'your-api-token',
);
$api = new Api($config);
$service = $api->clientService();

try {
    $clientId = '467029e9-d574-1484-680f-e10683283ed5';

    $clientData = $service->getClient($clientId)->getResponseData();
} catch (ValidationException $e) {
    // HTTP 422 error containing an array of validation errors
    $error = $e->getApiError();
    $validationErrors = $e->getValidationErrors();
    // ...
} catch (HttpException $e) {
    // Any other HTTP error response
    $error = $e->getApiError();
    // ...
}
```

#### HTTP Exceptions Disabled

[](#http-exceptions-disabled)

With HTTP exceptions disabled, you can inspect the ApiResponse to determine whether it succeeded or not.

```
use Upmind\Sdk\Api;
use Upmind\Sdk\Config;

$config = new Config(
    token: 'your-api-token',
    restfulExceptions: false, // don't throw exceptions for API error responses
);
$api = new Api($config);
$service = $api->clientService();

$clientId = '467029e9-d574-1484-680f-e10683283ed5';

$response = $service->getClient($clientId);
if ($response->isSuccessful()) {
    $clientData = $response->getResponseData();
    // ...
} else {
    $error = $response->getResponseError();
    // ...
}
```

### Pagination

[](#pagination)

Most list requests will return paginated results. The SDK will allow you to pass a `QueryParams` object to control pagination by setting `limit` (default 10) and `offset` (default 0) query parameters.

```
use Upmind\Sdk\Data\QueryParams;

$queryParams = QueryParams::new()
    ->setLimit(20) // returns up to 20 results
    ->setOffset(100); // skips the first 100 results

$clients = $api->clientService()
    ->listClients($queryParams)
    ->getResponseData();
foreach ($clients as $clientData) {
    $clientId = $clientData['id'];
    // ...
}
```

### Relations

[](#relations)

Some resources have relationships with other resources. You can specify relationships to load by setting the `with` query parameter when making GET requests. This reduces the number of API requests needed to fetch related resources.

```
use Upmind\Sdk\Data\QueryParams;

$clientId = '467029e9-d574-1484-680f-e10683283ed5';
$queryParams = QueryParams::new()
    ->setWith(['emails', 'addresses']); // load the client's emails and addresses

$clientData = $api->clientService()
    ->getClient($clientId, $queryParams)
    ->getResponseData();
foreach ($clientData['emails'] as $emailData) {
    // ...
}
foreach ($clientData['addresses'] as $addressData) {
    // ...
}
```

### Creating Resources

[](#creating-resources)

Create methods are typed with DTOs containing setter methods to help you identify which parameters are available. When a resource is created successfully, an `id` will be returned which can be used to fetch and manage the resource later.

```
use Upmind\Sdk\Data\Services\CreateEmailParams;

$clientId = '467029e9-d574-1484-680f-e10683283ed5';
$createEmail = CreateEmailParams::new()
    ->setEmail('harry@upmind.com')
    ->setDefault(true);

$emailData = $api->emailService()
    ->createEmail($clientId, $createEmail)
    ->getResponseData();
$emailId = $emailData['id'];
// ...
```

### Manual Usage

[](#manual-usage)

Some resources may not have a corresponding service in the SDK. You can use the `Api` client to make requests manually to any endpoint. Here's an example showing how to import an existing order (contract product) into Upmind.

```
use Upmind\Sdk\Data\BodyParams;

$clientId = '467029e9-d574-1484-680f-e10683283ed5';
$hostingServerId = 'e5750263-4647-9ed1-26a2-1053288d79e9'; // server provision configuration id
$hostingProductId = 'd6d97847-5d49-2153-2def-d163e080e253'; // catalogue product id
$premiumSupportProductId = 'd9860720-492e-710d-0d6b-8165d83d345e'; // catalogue product option id
$hostingLocationProductId = '84856376-2e90-516e-607a-e17d48302de9'; // catalogue product attribute id

$body = BodyParams::new()
    ->setParam('category_slug', 'new_contract')
    ->setParam('client_id', $clientId)
    ->setParam('currency_code', 'GBP')
    ->setParam('manual_import', true) // setting to true allows us to override activation/due dates
    ->setParam('activation_date', '2022-05-01') // initial order activation date
    ->setParam('next_due_date', '2024-10-01') // current date the order is paid up until
    ->setParam('products', [
        [
            'product_id' => $hostingProductId,
            'quantity' => 1,
            'billing_cycle_months' => 6, // renews every 6 months
            'selling_price' => 35.99, // the net price of the base product
            'provision_configuration_id' => $hostingServerId,
            'provision_field_values' => [ // hosting product provision fields
                'domain' => 'example.com',
                'username' => 'example2',
            ],
            'options' => [
                [
                    'product_id' => $premiumSupportProductId,
                    'quantity' => 1,
                    'billing_cycle_months' => 6, // renews with the base product
                    'selling_price' => 30.00, // the net price of the option; this gets added to the base product price
                ]
            ],
            'attributes' => [
                [
                    'product_id' => $hostingLocationProductId,
                ]
            ]
        ]
    ]);

$responseData = $api->post('/api/admin/orders/quick', $body)->getResponseData();
$orderNumber = $responseData['number'];
$contractId = $responseData['contract_id'];
$contractProductId = $responseData['products'][0]['contracts_product_id'];
// ...
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Harry Lewis](https://github.com/uphlewis)
- [Sam Burns](https://github.com/sam-bee)
- [All Contributors](../../contributors)

License
-------

[](#license)

GNU General Public License version 3 (GPLv3). Please see [License File](LICENSE.md) for more information.

Upmind
------

[](#upmind)

Sell, manage and support web hosting, domain names, ssl certificates, website builders and more with [Upmind.com](https://upmind.com/start).

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance42

Moderate activity, may be stable

Popularity28

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 77.8% 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 ~140 days

Total

4

Last Release

243d ago

Major Versions

v0.2.0 → v1.0.02024-08-06

PHP version history (3 changes)v0.1.0PHP ^8.2

v0.2.0PHP 7.4.\* | 8.0.\* | 8.1.\* | 8.2.\* | 8.3.\*

v1.1.0PHP 7.4.\* | 8.0.\* | 8.1.\* | 8.2.\* | 8.3.\* | 8.4.\*

### Community

Maintainers

![](https://www.gravatar.com/avatar/cff84f90ef00830deef6ed09c1cffb47ec1ea1d2f2b7e97cc5caf39c898c79e6?d=identicon)[uphlewis](/maintainers/uphlewis)

---

Top Contributors

[![uphlewis](https://avatars.githubusercontent.com/u/43346009?v=4)](https://github.com/uphlewis "uphlewis (70 commits)")[![sam-bee](https://avatars.githubusercontent.com/u/130986804?v=4)](https://github.com/sam-bee "sam-bee (20 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/upmind-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/upmind-sdk/health.svg)](https://phpackages.com/packages/upmind-sdk)
```

###  Alternatives

[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[deeplcom/deepl-php

Official DeepL API Client Library

2616.2M66](/packages/deeplcom-deepl-php)[jolicode/slack-php-api

An up to date PHP client for Slack's API

2534.4M12](/packages/jolicode-slack-php-api)[chartmogul/chartmogul-php

ChartMogul API PHP Client

181.4M](/packages/chartmogul-chartmogul-php)[brd6/notion-sdk-php

Notion SDK for PHP

5918.0k](/packages/brd6-notion-sdk-php)[partitech/php-mistral

Connect to Mistral | Anthropic | Xai | Hugging Face | LamaC++ | Vllm | Ollama

2624.1k1](/packages/partitech-php-mistral)

PHPackages © 2026

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