Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
199a9fb
feat(tasks): add missing API methods across 9 task classes
flovntp Jun 3, 2026
f46b025
lint fix
flovntp Jun 3, 2026
a397c1b
remove phpdoc cache folder
flovntp Jun 3, 2026
0e21cd5
chore: ignore .phpdoc cache and deployments_current.json
flovntp Jun 3, 2026
b7e5e01
add missing API call + test
flovntp Jun 4, 2026
8059895
manage ndjson format + missing tests
flovntp Jun 4, 2026
944dc79
manage ndjson format + missing tests
flovntp Jun 4, 2026
6d5e753
add missing tests
flovntp Jun 4, 2026
459fb6a
add more tests
flovntp Jun 5, 2026
5b30014
add missing calls
flovntp Jun 8, 2026
a1a6efb
fix(oauth2): port Node SDK PR #11 β€” refresh_token, forceRefresh, 120s…
Theosakamg Jun 4, 2026
e03f84c
refactor(api): rename APIConfiguration β†’ ApiConfiguration everywhere,…
Theosakamg Jun 4, 2026
d6b586e
chore(regen): regenerate SDK models and update OAuthProvider post-reg…
Theosakamg Jun 4, 2026
6befa53
chore(regen): full SDK regeneration β€” Api, Model, Serializer classes
Theosakamg Jun 4, 2026
66ace00
test(oauth2): add AbstractApiTest (401 retry) and OAuthProvider edge-…
Theosakamg Jun 4, 2026
ceb5171
refactor(oauth): remove unreachable guard in refreshAccessToken()
Theosakamg Jun 4, 2026
421b80e
feat(auth): bearer mode, Fiber thundering-herd guard, $_retried anti-…
Theosakamg Jun 4, 2026
87827d7
style: use imported Closure/Fiber names instead of FQNS backslash prefix
Theosakamg Jun 4, 2026
289b3fb
refactor(auth): introduce TokenProvider interface for typed token acq…
Theosakamg Jun 4, 2026
330901b
fix(templates): sync abstract_api.mustache import order with generate…
Theosakamg Jun 4, 2026
8a54080
style: fix:all cleanup + sync oauth_provider.mustache with generated …
Theosakamg Jun 4, 2026
d1fef09
Fix lint
Theosakamg Jun 4, 2026
70183e1
fix(fiber): use canonical Fiber::suspend() static call instead of nul…
Theosakamg Jun 4, 2026
5edc873
feat(tasks): add missing API methods across 9 task classes
flovntp Jun 3, 2026
3ea1c22
add missing API call + test
flovntp Jun 4, 2026
d0750bd
manage ndjson format + missing tests
flovntp Jun 4, 2026
82d5bc9
rebase main
flovntp Jun 8, 2026
93a3887
add ->taskContainers
flovntp Jun 8, 2026
f72a63f
init ResponseObject
flovntp Jun 8, 2026
0bf1517
improve ApiException handler
flovntp Jun 9, 2026
f284f75
improve TaskContainers docs about variables format
flovntp Jun 9, 2026
761ccbc
remove useless function task
flovntp Jun 15, 2026
2d4c5dc
remove useless params
flovntp Jun 15, 2026
0811f7c
Merge branch 'main' into add-missing-api-call
flovntp Jun 15, 2026
6cb04c3
add client-credentials and tokenTtl
flovntp Jun 15, 2026
a139e99
update Docs link
flovntp Jun 15, 2026
79030d8
update Docs link
flovntp Jun 15, 2026
84498ba
remove .phpdoc
flovntp Jun 15, 2026
d88f2fb
solve inconsistency + test
flovntp Jun 15, 2026
9c87b45
add missing tests
flovntp Jun 16, 2026
0e67c66
remove deprecated API call and replace them by new endpoint
flovntp Jun 17, 2026
7198807
mark deprecated to task function using a deprecated API endpoint
flovntp Jun 17, 2026
f26c677
revert config.yaml changes to avoid too many updates
flovntp Jun 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ Install the SDK via Composer:
composer require upsun/upsun-sdk-php
```

> **Important**:
> This SDK relies on PSR interfaces and requires a **PSR-18 HTTP client** implementation at runtime.
> If your project does not already provide one, install a compatible client, for example:
>
> ```bash
> composer require symfony/http-client
> ```

Then include Composer's autoloader in your PHP application:

```php
Expand All @@ -26,9 +34,13 @@ require __DIR__ . '/vendor/autoload.php';

## Authentication

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

### With an API token (default)

Use this outside of an Upsun runtime, authenticating with your API token.

```php
use Upsun\UpsunConfig;
use Upsun\UpsunClient;
Expand All @@ -37,6 +49,24 @@ $config = new UpsunConfig(apiToken: getenv('UPSUN_API_TOKEN'));
$upsunClient = new UpsunClient($config);
```

### With the local token service (inside an Upsun container)

Inside an Upsun runtime container, a local token service is exposed on
`http://localhost:8200`. Point `auth_url` to `UpsunConfig::LOCAL_AUTH` and the SDK
authenticates with the `client_credentials` grant automatically (no API token
required). You may optionally request a token lifetime via `tokenTtl` (60-900 seconds).

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

$config = new UpsunConfig(
auth_url: UpsunConfig::LOCAL_AUTH,
tokenTtl: 900, // optional, 60-900 seconds
);
$upsunClient = new UpsunClient($config);
```

## Usage

### Example: List organizations
Expand Down Expand Up @@ -72,7 +102,7 @@ composer install

The SDK is built as follows:

* From the [JSON specs of our API](https://docs.upsun.com/api/openapispec-upsun.json)
* From the [JSON specs of our API](https://meta.upsun.com/openapi-spec)
* Using [``@openapitools/openapi-generator-cli``](https://www.npmjs.com/package/%40openapitools/openapi-generator-cli)
* Which generates:
* PHP **Models** (in `src/Model/`)
Expand All @@ -82,7 +112,7 @@ The SDK is built as follows:
### 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).
from the [Upsun OpenAPI spec](https://meta.upsun.com/openapi-spec).

```bash
composer run spec:install
Expand Down
Loading