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

ActiveLibrary[API Development](/categories/api)

upsun/upsun-sdk-php
===================

The official Upsun SDK for PHP

v0.7.0(2mo ago)81.7k1[2 PRs](https://github.com/upsun/upsun-sdk-php/pulls)Apache-2.0PHPPHP &gt;=8.1CI passing

Since Oct 29Pushed 2w ago8 watchersCompare

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

READMEChangelog (7)Dependencies (57)Versions (15)Used By (0)

Upsun SDK PHP
=============

[](#upsun-sdk-php)

The official **Upsun SDK for PHP**. This SDK provides a PHP interface that maps to the Upsun CLI commands.

For more information, read [the documentation](https://docs.upsun.com/api).

> **CAUTION**: This project is currently in **Beta**, meaning features and APIs may evolve over time.
>
> Please report bugs or request new features by creating a GitHub issue.

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

[](#installation)

Install the SDK via Composer:

```
composer require upsun/upsun-sdk-php
```

Then include Composer's autoloader in your PHP application:

```
require __DIR__ . '/vendor/autoload.php';
```

Authentication
--------------

[](#authentication)

### With an API token (default)

[](#with-an-api-token-default)

You will need an [Upsun API token](https://docs.upsun.com/administration/cli/api-tokens.html) to use this SDK. Store it securely, preferably in an environment variable.

```
use Upsun\UpsunConfig;
use Upsun\UpsunClient;

$config = new UpsunConfig(apiToken: getenv('UPSUN_API_TOKEN'));
$upsunClient = new UpsunClient($config);
```

### With an OAuth2 client (client\_credentials grant)

[](#with-an-oauth2-client-client_credentials-grant)

If you have a registered OAuth2 client, the SDK can authenticate with the standard `client_credentials` grant (RFC 6749 §4.4): the client id and secret are sent via HTTP Basic authentication, and an optional `scope` can be requested.

```
use Upsun\Core\OAuthProvider;
use Upsun\UpsunConfig;
use Upsun\UpsunClient;

$config = new UpsunConfig(
    grantType: OAuthProvider::GRANT_CLIENT_CREDENTIALS,
    clientId: getenv('OAUTH_CLIENT_ID'),
    apiToken: getenv('OAUTH_CLIENT_SECRET'), // the client secret
    scope: 'projects:read', // optional
);
$upsunClient = new UpsunClient($config);
```

Usage
-----

[](#usage)

### Example: List organizations

[](#example-list-organizations)

```
$organizations = $upsunClient->organizations->list();
```

### Example: List projects in an organization

[](#example-list-projects-in-an-organization)

```
$projects = $upsunClient->projects->list('');
```

### Example: Redeploy an environment

[](#example-redeploy-an-environment)

```
$response = $upsunClient->environments->redeploy('', '');
```

---

Development
-----------

[](#development)

Clone the repository and install dependencies:

```
git clone git@github.com:upsun/upsun-sdk-php.git
composer install
```

Architecture of this SDK
------------------------

[](#architecture-of-this-sdk)

The SDK is built as follows:

- From the [JSON specs of our API](https://docs.upsun.com/api/openapispec-upsun.json)
- Using [`@openapitools/openapi-generator-cli`](https://www.npmjs.com/package/%40openapitools/openapi-generator-cli)
- Which generates:
    - PHP **Models** (in `src/Model/`)
    - PHP **APIs** (in `src/Api/`)
- Higher-level PHP (Facade) oriented **Tasks** (in `src/Core/Tasks/`)

### Regenerating API &amp; Model classes

[](#regenerating-api--model-classes)

API and Model classes are generated using [openapi-generator-cli](https://openapi-generator.tech)from the [Upsun OpenAPI spec](https://docs.upsun.com/api/openapispec-upsun.json).

```
composer run spec:install
composer run spec:full
```

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

[](#contributing)

Contributions are welcome!
Please open a [pull request](https://github.com/upsun/upsun-sdk-php/compare) or an [issue](https://github.com/upsun/upsun-sdk-php/issues/new)for any improvements, bug fixes, or new features.

Publishing
----------

[](#publishing)

To generate a new version of the Upsun SDK PHP and automatically publish it on

1. update your local

```
git fetch
git checkout main
git pull
```

2. check existing tags on
3. create a new tag from your local

```
git tag v
git push --tag
```

4. Go on release page:
5. create a new release based on the previously created tag (Do not forget to autogenerate description in the form)
6. check publishing action status:
7. check new release version on

Tests
-----

[](#tests)

To run the tests, use:

```
composer install
composer run test
```

License
-------

[](#license)

This project is licensed under the Apache License 2.0. See the [LICENSE](https://github.com/upsun/upsun-sdk-php/blob/main/LICENSE) and [NOTICE](https://github.com/upsun/upsun-sdk-php/blob/main/NOTICE) files for details.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance91

Actively maintained with recent releases

Popularity27

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.9% 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 ~31 days

Recently: every ~53 days

Total

8

Last Release

76d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b4518010a3eb800a5ede865b20b64814514fa28d80cd35f42215d4dc3c99c593?d=identicon)[platformsh-devrel](/maintainers/platformsh-devrel)

![](https://avatars.githubusercontent.com/u/1842696?v=4)[Flo HUCK](/maintainers/flovntp)[@flovntp](https://github.com/flovntp)

![](https://avatars.githubusercontent.com/u/1913401?v=4)[Mickael Gaillard](/maintainers/Theosakamg)[@Theosakamg](https://github.com/Theosakamg)

---

Top Contributors

[![flovntp](https://avatars.githubusercontent.com/u/1842696?v=4)](https://github.com/flovntp "flovntp (602 commits)")[![Theosakamg](https://avatars.githubusercontent.com/u/1913401?v=4)](https://github.com/Theosakamg "Theosakamg (52 commits)")[![fabpot](https://avatars.githubusercontent.com/u/47313?v=4)](https://github.com/fabpot "fabpot (26 commits)")[![platformsh-devrel](https://avatars.githubusercontent.com/u/51342364?v=4)](https://github.com/platformsh-devrel "platformsh-devrel (3 commits)")[![anacidre](https://avatars.githubusercontent.com/u/19813968?v=4)](https://github.com/anacidre "anacidre (1 commits)")[![ziomizar](https://avatars.githubusercontent.com/u/1380349?v=4)](https://github.com/ziomizar "ziomizar (1 commits)")

---

Tags

activationadvocacyphp-librarysdkphpapisdkupsun

###  Code Quality

TestsPHPUnit

Static AnalysisRector

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

36826.2k2](/packages/telnyx-telnyx-php)[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k29.9M347](/packages/openai-php-client)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k6.0M777](/packages/sylius-sylius)[getbrevo/brevo-php

Official PHP SDK for the Brevo API.

1004.1M59](/packages/getbrevo-brevo-php)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.8M672](/packages/shopware-core)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)

PHPackages © 2026

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