> ## Documentation Index
> Fetch the complete documentation index at: https://developer.upsun.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Introducing the Upsun PHP SDK

> Discover how the Upsun PHP SDK simplifies API access and speeds up integrations, with clear documentation and modern tooling.

export const PostMeta = ({data = {}}) => {
  const {author, date, image} = data;
  const authors = Array.isArray(author) ? author : author ? [author] : [];
  const resolveAuthor = slug => {
    const entry = AUTHOR_MAP[slug] || ({});
    const name = entry.name || slug;
    const github = entry.github || null;
    const linkedin = entry.linkedin || null;
    const url = github ? `https://github.com/${github}` : linkedin || null;
    const avatarUrl = github ? `https://github.com/${github}.png?size=64` : null;
    return {
      name,
      url,
      avatarUrl
    };
  };
  const formattedDate = date ? new Date(date).toLocaleDateString('en-US', {
    year: 'numeric',
    month: 'long',
    day: 'numeric'
  }) : null;
  if (!image && authors.length === 0 && !formattedDate) return null;
  const AUTHOR_MAP = {
    "aaron-collier": {
      "name": "Aaron Collier"
    },
    "aaron-dudenhofer": {
      "name": "Aaron Dudenhofer"
    },
    "aaron-porter": {
      "name": "Aaron Porter"
    },
    "adriaan-odendaal": {
      "name": "Adriaan Odendaal"
    },
    "ajmal": {
      "name": "Ajmal Siddiqui"
    },
    "akalipetis": {
      "name": "Antonis Kalipetis"
    },
    "alexander-varwijk": {
      "name": "Alexander Varwijk"
    },
    "alicia-bevilacqua": {
      "name": "Alicia Bevilacqua"
    },
    "amelie-deguerry": {
      "name": "Amelie Deguerry"
    },
    "anacidre": {
      "name": "Ana Cidre",
      "linkedin": "https://www.linkedin.com/in/ana-cidre"
    },
    "andoni": {
      "name": "Andoni Auzmendi"
    },
    "andrei-taranu": {
      "name": "Andrei (Alex) Taranu",
      "linkedin": "https://www.linkedin.com/in/andrei-alex-taranu/"
    },
    "andrew-baxter": {
      "name": "Andrew Baxter"
    },
    "andrew-melck": {
      "name": "Andrew Melck"
    },
    "antoine-crochet-damais": {
      "name": "Antoine Crochet Damais"
    },
    "augustin-delaporte": {
      "name": "Augustin Delaporte",
      "linkedin": "https://www.linkedin.com/in/augustindelaporte/"
    },
    "branislav-bujisic": {
      "name": "Branislav Bujisic"
    },
    "carl-smith": {
      "name": "Carl Smith"
    },
    "caroline-leroy": {
      "name": "Caroline Leroy"
    },
    "cati-mayer": {
      "name": "Cati Mayer"
    },
    "catplat": {
      "name": "C Trinkwon"
    },
    "ceelolulu": {
      "name": "Celeste van der Watt"
    },
    "chadwcarlson": {
      "name": "Chad Carlson",
      "github": "chadwcarlson",
      "linkedin": "https://www.linkedin.com/in/chadwcarlson"
    },
    "chris-ward": {
      "name": "Chris Ward"
    },
    "chris-yates": {
      "name": "Chris Yates"
    },
    "christian-sieber": {
      "name": "Christian Sieber"
    },
    "christopher-lockheardt": {
      "name": "Christopher Lockheardt"
    },
    "christopher-skene": {
      "name": "Christopher Skene"
    },
    "chuck-morgan": {
      "name": "Chuck Morgan"
    },
    "corey-dockendorf": {
      "name": "Corey Dockendorf"
    },
    "crell": {
      "name": "Crell"
    },
    "damz": {
      "name": "Damz"
    },
    "dan-morrison": {
      "name": "Dan Morrison"
    },
    "davidbonachera": {
      "name": "David Bonachera",
      "github": "davidbonachera",
      "linkedin": "https://www.linkedin.com/in/davidbonachera"
    },
    "dereliahmet1": {
      "name": "Ahmet Faruk Dereli"
    },
    "devicezero": {
      "name": "Jonas Kröger",
      "github": "devicezero",
      "linkedin": "https://www.linkedin.com/in/jonaskroeger/"
    },
    "doug-goldberg": {
      "name": "Doug Goldberg"
    },
    "duncan-naves": {
      "name": "Duncan Naves",
      "github": "duncannaves",
      "linkedin": "https://www.linkedin.com/in/duncan-naves-a94423aa"
    },
    "erika-bustamante": {
      "name": "Erika Bustamante"
    },
    "fabpot": {
      "name": "Fabien Potencier"
    },
    "flovntp": {
      "name": "Florent Huck",
      "github": "flovntp",
      "linkedin": "https://www.linkedin.com/in/florenthuck"
    },
    "fred-plais": {
      "name": "Fred Plais"
    },
    "gauthier-garnier": {
      "name": "Gauthier Garnier"
    },
    "gilzow": {
      "name": "Paul Gilzow"
    },
    "gmoigneu": {
      "name": "Guillaume Moigneu",
      "github": "gmoigneu",
      "linkedin": "https://www.linkedin.com/in/guillaumemoigneu/"
    },
    "gregqualls": {
      "name": "Greg Qualls"
    },
    "guguss": {
      "name": "Augustin Delaporte"
    },
    "haylee-millar": {
      "name": "Haylee Millar"
    },
    "ivana-kotur": {
      "name": "Ivana Kotur"
    },
    "jackrabbithanna": {
      "name": "Mark Hanna"
    },
    "jared-wright": {
      "name": "Jared Wright",
      "github": "jww-sh",
      "linkedin": "https://www.linkedin.com/in/jaredwaynewright"
    },
    "jessica-orozco": {
      "name": "Jessica Orozco"
    },
    "joey-stanford": {
      "name": "Joey Stanford"
    },
    "john-grubb": {
      "name": "John Grubb"
    },
    "jonas-kruger": {
      "name": "Jonas Kruger"
    },
    "kathryn-frazer": {
      "name": "Kathryn Frazer"
    },
    "kemiojo": {
      "name": "Kemi Elizabeth Ojogbede"
    },
    "kieronsambrook-smith": {
      "name": "Kieronsambrook Smith"
    },
    "laurent-arnoud": {
      "name": "Laurent Arnoud"
    },
    "letoya-boyne": {
      "name": "Letoya Boyne"
    },
    "lolautruche": {
      "name": "Jérôme Vieilledent"
    },
    "lyly-lepinay": {
      "name": "Lyly Lepinay"
    },
    "manauwar-alam": {
      "name": "Manauwar Alam"
    },
    "marc-antoine-porri": {
      "name": "Marc Antoine Porri"
    },
    "maria-antinkaapo": {
      "name": "Maria Antinkaapo"
    },
    "maria-de-anton": {
      "name": "Maria De Anton"
    },
    "mark-dorison": {
      "name": "Mark Dorison"
    },
    "markus-hausammann": {
      "name": "Markus Hausammann"
    },
    "mary-thomas": {
      "name": "Mary Thomas"
    },
    "mathias-bolt-lesniak": {
      "name": "Mathias Bolt Lesniak"
    },
    "mathieu-strauch": {
      "name": "Mathieu Strauch"
    },
    "matthias-van-woensel": {
      "name": "Matthias Van Woensel",
      "linkedin": "https://www.linkedin.com/in/matthias-van-woensel-267a069"
    },
    "michael-sharp": {
      "name": "Michael Sharp"
    },
    "mupsi": {
      "name": "Marine Gandy"
    },
    "natalie-harper": {
      "name": "Natalie Harper"
    },
    "ngommenginger": {
      "name": "Nicolas Gommenginger",
      "linkedin": "https://www.linkedin.com/in/nicolas-gommenginger"
    },
    "nicholas-bennison": {
      "name": "Nicholas Bennison"
    },
    "nicholas-vahalik": {
      "name": "Nicholas Vahalik"
    },
    "nick-hardiman": {
      "name": "Nick Hardiman"
    },
    "nickanderegg": {
      "name": "Nickanderegg"
    },
    "nicolas-grekas": {
      "name": "Nicolas Grekas",
      "github": "nicolas-grekas",
      "linkedin": "https://www.linkedin.com/in/nicolasgrekas/"
    },
    "niti-malwade": {
      "name": "Niti Malwade"
    },
    "opensocialteam": {
      "name": "Opensocialteam"
    },
    "ori-pekelman": {
      "name": "Ori Pekelman"
    },
    "otavio-santana": {
      "name": "Otavio Santana"
    },
    "palwandi": {
      "name": "Pawan Alwandi",
      "github": "pawpy",
      "linkedin": "https://www.linkedin.com/in/pawanalwandi"
    },
    "patrick-boest": {
      "name": "Patrick Boest"
    },
    "patrick-dawkins": {
      "name": "Patrick Dawkins",
      "github": "pjcdawkins",
      "linkedin": "https://www.linkedin.com/in/patrickdawkins"
    },
    "patrick-klima": {
      "name": "Patrick Klima"
    },
    "pjcdawkins": {
      "name": "Pjcdawkins"
    },
    "prineet-kaurbhurji": {
      "name": "Prineet Kaurbhurji"
    },
    "quentin-sinig": {
      "name": "Quentin Sinig"
    },
    "ralt": {
      "name": "Florian Margaine",
      "github": "ralt",
      "linkedin": "https://www.linkedin.com/in/florian-margaine-43971136"
    },
    "ramanathanramakrishnamurthy": {
      "name": "Ramanathanramakrishnamurthy"
    },
    "remi-lejeune": {
      "name": "Rémi Lejeune"
    },
    "ribel": {
      "name": "Taras Kruts"
    },
    "robert-douglass": {
      "name": "Robert Douglass"
    },
    "rudy-weber": {
      "name": "Rudy Weber"
    },
    "ryan-hicks": {
      "name": "Ryan Hicks"
    },
    "sabri-helal": {
      "name": "Sabri Helal"
    },
    "savannah-bergeron": {
      "name": "Savannah Bergeron"
    },
    "shannon-vettes": {
      "name": "Shannon Vettes"
    },
    "shawn-ogasawara": {
      "name": "Shawn Ogasawara",
      "linkedin": "https://www.linkedin.com/in/shawn-ogasawara-83a9a0/"
    },
    "shawna-spoor": {
      "name": "Shawna Spoor"
    },
    "shedrack-akintayo": {
      "name": "Shedrack Akintayo"
    },
    "simon-ruggier": {
      "name": "Simon Ruggier"
    },
    "sophie-van-der-kindere": {
      "name": "Sophie Van Der Kindere"
    },
    "stefanos-thampis": {
      "name": "Stefanos Thampis"
    },
    "stephen-weinberg": {
      "name": "Stephen Weinberg"
    },
    "sukhman-virk": {
      "name": "Sukhman Virk"
    },
    "sumaira-nazir": {
      "name": "Sumaira Nazir"
    },
    "sumer": {
      "name": "Sümer Cip"
    },
    "syed-raza": {
      "name": "Syed Raza"
    },
    "tamara-bacchia": {
      "name": "Tamara Bacchia"
    },
    "tara-arnold": {
      "name": "Tara Arnold"
    },
    "theosakamg": {
      "name": "Mickael Gaillard",
      "github": "theosakamg"
    },
    "thomasdiluccio": {
      "name": "Thomas di Luccio"
    },
    "tim-anderson": {
      "name": "Tim Anderson"
    },
    "tom-helmer-hansen": {
      "name": "Tom Helmer Hansen"
    },
    "tylermills": {
      "name": "Tyler Mills"
    },
    "upsun": {
      "name": "Upsun"
    },
    "veronika-tolkachova": {
      "name": "Veronika Tolkachova",
      "linkedin": "https://www.linkedin.com/in/veronika-tolkachova-169167a2"
    },
    "vince-parker": {
      "name": "Vince Parker"
    },
    "vinnie-russo": {
      "name": "Vincenzo Russo"
    },
    "vrobert78": {
      "name": "Vincent Robert",
      "github": "vrobert78",
      "linkedin": "https://www.linkedin.com/in/vincent-robert-498a883"
    },
    "yuriy-babenko": {
      "name": "Yuriy Babenko"
    },
    "yuriy-gerasimov": {
      "name": "Yuriy Gerasimov"
    }
  };
  return <div className="post-meta">
      {(authors.length > 0 || formattedDate) && <div className="post-meta-info">
          {authors.length > 0 && <div className="post-meta-authors">
              {authors.map(slug => {
    const {name, url, avatarUrl} = resolveAuthor(slug);
    const inner = <>
                    {avatarUrl && <img src={avatarUrl} alt={name} className="post-meta-avatar" />}
                    <span className="post-meta-author-name">{name}</span>
                  </>;
    return url ? <a key={slug} href={url} target="_blank" rel="noopener noreferrer" className="post-meta-author">
                    {inner}
                  </a> : <span key={slug} className="post-meta-author">{inner}</span>;
  })}
            </div>}
          {authors.length > 0 && formattedDate && <span className="post-meta-separator" aria-hidden="true">·</span>}
          {formattedDate && <span className="post-meta-date">{formattedDate}</span>}
        </div>}
      {image && <img src={image} alt="" className="post-meta-image" aria-hidden="true" />}
    </div>;
};

<PostMeta data={{ author: ["flovntp"], date: "2025-11-04T00:00:00+00:00", image: "/images/posts/releases/upsun-php-sdk-announcement/upsun-sdk-php.webp" }} />

<Note>
  **Disclaimer:** This project is currently in **Beta**, meaning features and APIs may evolve over time.<br />
  👉 Please report bugs or request new features by [creating a GitHub issue](https://github.com/upsun/upsun-sdk-php/issues/new/choose).<br />
</Note>

**The [**Upsun SDK for PHP**](https://github.com/upsun/upsun-sdk-php/) is now available!** 🎉

This library gives PHP developers a convenient way to interact programmatically with all
[Upsun API endpoints](https://docs.upsun.com/api/) — the same ones used by the
[Upsun CLI](https://docs.upsun.com/administration/cli.html) and by the
[Console](https://docs.upsun.com/administration/web.html).

Whether you're [listing organizations](https://docs.upsun.com/api/#tag/References/operation/list-referenced-orgs),
[managing projects](https://docs.upsun.com/api/#tag/References/operation/list-referenced-projects),
or automating [platform tasks](https://docs.upsun.com/api/#tag/Runtime-Operations/operation/run-operation),
this SDK gives you full access with minimal setup.

## How it works

The SDK is generated from
the official [Upsun OpenAPI specification](https://docs.upsun.com/api/openapispec-platformsh.json) — the same source of
truth used by the official Upsun CLI and Upsun Console.

Before running the [OpenAPI Generator](https://openapi-generator.tech) to build the SDK, we run a [PHP pre-processing script](https://github.com/upsun/upsun-sdk-php/blob/main/templates/pre-processing/preprocess-schema.php) —
`templates/pre-processing/preprocess-schema.php`.
Its job is to enrich the OpenAPI schema with a bit of extra data (fields like `x-*`) for each endpoint method.
We can’t easily inject that info directly from the [Mustache templates](https://openapi-generator.tech/docs/templating/)
, because in Mustache only basic `if` tests are possible — no transformation logic or complex operations can be
performed. This script handles all the necessary transformations beforehand, so the OpenAPI Generator has everything it
needs up front, while our templates stay clean, simple, and focused.

The SDK is then built using [OpenAPI Generator](https://openapi-generator.tech), producing:

* **Models** (`src/Model/`): PHP representations of the Component schemas defined in the OpenAPI specification
* **APIs** (`src/Api/`): PHP classes for each API endpoint, providing low-level methods to interact with the platform

On top of these generated classes, we provide a set of [higher-level Tasks](https://github.com/upsun/upsun-sdk-php/tree/main/src/Core/Tasks)
(`src/Tasks/`).
These are handwritten by our **Advocacy team** and serve as the SDK’s **public-facing interface**, giving developers
simple, intuitive methods for common actions without having to deal with the low-level Models or APIs directly.

<img src="https://mintcdn.com/upsun-c9761871/eXV27YLeu5lESGxN/images/posts/releases/upsun-php-sdk-announcement/sdk-schema.webp?fit=max&auto=format&n=eXV27YLeu5lESGxN&q=85&s=c275fa46e80b7ca8b8f212abcaf3f6ea" alt="Architecture of the SDK" width="2792" height="2088" data-path="images/posts/releases/upsun-php-sdk-announcement/sdk-schema.webp" />

This approach ensures the SDK stays closely aligned with the platform’s evolving API while providing a clean,
developer-friendly interface, making it easier to maintain and extend over time.

## Staying up to date

Every day, a [GitHub workflow](https://github.com/upsun/upsun-sdk-php/blob/main/.github/workflows/check_api.yaml)
checks the official OpenAPI spec against our local version.
If it finds any differences, it automatically opens a Pull Request and notifies our Advocacy team to keep the SDK
aligned with the live API.

## Usage examples

To give you an overview of what you can do with this Upsun SDK PHP, here are some examples below:

### Installation

Install the Upsun SDK PHP via Composer:

```bash {filename="Terminal"} theme={null}
composer require upsun/upsun-sdk-php
```

Then include Composer’s autoloader in your PHP application:

```php {filename="test-sdk.php",base_url="https://github.com/upsun/upsun-sdk-php/blob/main/"} theme={null}
require __DIR__ . '/vendor/autoload.php';
```

### Authentication

You’ll need an [Upsun API token](https://docs.upsun.com/administration/cli/api-tokens.html) to use the SDK.\
Store it securely, for example in an environment variable:

```php {filename="test-sdk.php",base_url="https://github.com/upsun/upsun-sdk-php/blob/main/"} theme={null}
use Upsun\UpsunConfig;
use Upsun\UpsunClient;

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

### List organizations

```php {filename="test-sdk.php",base_url="https://github.com/upsun/upsun-sdk-php/blob/main/"} theme={null}
$organizations = $client->organizations->list();
```

### List projects in an organization

```php {filename="test-sdk.php",base_url="https://github.com/upsun/upsun-sdk-php/blob/main/"} theme={null}
$projects = $client->organizations->listProjects('<organizationId>');
```

### Get a project

```php {filename="test-sdk.php",base_url="https://github.com/upsun/upsun-sdk-php/blob/main/"} theme={null}
$project = $client->projects->get('<projectId>');
```

### Create a new project

```php {filename="test-sdk.php",base_url="https://github.com/upsun/upsun-sdk-php/blob/main/"} theme={null}
// without explicit parameters
$project = $client->projects->create(
    '<organizationId>',
    'eu-5.platform.sh',
    'Project title',
    'main',
);
```

### Update a project

```php {filename="test-sdk.php",base_url="https://github.com/upsun/upsun-sdk-php/blob/main/"} theme={null}
// with explicit parameters
$response = $client->projects->update(
    projectId: '<projectId>',
    title: 'new Title',
    description: 'Description'
);
```

### Delete a project

```php {filename="test-sdk.php",base_url="https://github.com/upsun/upsun-sdk-php/blob/main/"} theme={null}
$client->projects->delete('<projectId>');
```

<Note>
  You can find the complete example in this [test-sdk.php](https://github.com/upsun/upsun-sdk-php/blob/main/test-sdk.php) file.
</Note>

## Clear and helpful PHPDoc

Every class, property, and method in the SDK is carefully documented.\
The PHPDoc comments are written to **guide you through each endpoint, model, and expected parameter**, making the SDK
easy to navigate with IDE autocomplete and inline hints.

This means developers can explore the SDK intuitively — just type `$client->` and let your IDE show you what’s
available.
And when a task method expects an array (for example, the `$client->projects->create()` [call](#create-a-new-project),
the PHPDoc includes a detailed description of the expected array structure, so you always know exactly which keys and
values to provide.

## Coverage

* **Full API Coverage:** Access every [Upsun public API endpoint](https://docs.upsun.com/api/).
* **Simple Authentication:** Use your [Upsun API token](https://docs.upsun.com/administration/cli/api-tokens.html) to
  connect instantly.
* **Modern PHP Design:** Compatible with PHP 8.1 and later, using readonly properties and strict typing.
* **Auto-generated Models and APIs:** Consistent and always [up to date](#staying-up-to-date) with Upsun’s OpenAPI spec.
* **Comprehensive Test Suite**: Every task is covered by PHPUnit tests similar to the example below.

```shell theme={null}
composer run test
PHPUnit 9.6.29 by Sebastian Bergmann and contributors.

...............................................................  63 / 476 ( 13%)
............................................................... 126 / 476 ( 26%)
............................................................... 189 / 476 ( 39%)
............................................................... 252 / 476 ( 52%)
............................................................... 315 / 476 ( 66%)
............................................................... 378 / 476 ( 79%)
............................................................... 441 / 476 ( 92%)
...................................                             476 / 476 (100%)

Time: 00:00.483, Memory: 54.00 MB

OK (476 tests, 3535 assertions)
```

## Contributing

Contributions are more than welcome!
If you find bugs, have ideas, or want to add new API endpoints, please open
a [pull request](https://github.com/upsun/upsun-sdk-php/compare) or
a [GitHub issue](https://github.com/upsun/upsun-sdk-php/issues/new).

You can also reach out to the Advocacy team and other developers on
our [Discord community](https://discord.gg/upsun).

## Final thoughts

This SDK marks a first step toward making Upsun’s public APIs easier to use from PHP-based projects.\
It’s still experimental, but it already provides full access to our API endpoints — and it’s built to evolve alongside
Upsun itself.

If you’re a PHP developer building automation, tooling, or integrations on Upsun, give it a try and tell us what you
think!

👉 **Try it today:** [github.com/upsun/upsun-sdk-php](https://github.com/upsun/upsun-sdk-php)

***

## Coming soon: SDKs for Node.js, Python, and Go

The Upsun Advocacy team is also working on official SDKs for **Node.js**, **Python**, and **Go**.\
Each SDK will follow the same philosophy as the PHP one — open-source, API-spec driven, and developer-friendly.

Stay tuned for future announcements and beta releases on our GitHub organization and Discord server.

***

*— The Upsun Advocacy Team*
