Download the PHP
package welcomattic/clevercloud-php-sdk without Composer
On this page you can find all versions of the php package
welcomattic/clevercloud-php-sdk . It is possible to download/install
these versions without Composer . Possible dependencies are resolved
automatically.
FAQ
After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.
Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements. In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories.
In this case some credentials are needed to access such packages.
Please use the auth.json textarea to insert credentials, if a package is coming from a private repository.
You can look
here for more information.
Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
To use Composer is sometimes complicated. Especially for beginners.
Composer needs much resources. Sometimes they are not available on a simple webspace.
If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?
Informations about the package clevercloud-php-sdk
# Clever Cloud PHP SDK
A modern PHP SDK for the [Clever Cloud](https://www.clever-cloud.com) REST API
(v2 + v4 + api-bridge).
> Status: **v2.0**. Public API surface is stable; changes that break
> source compatibility will trigger a major bump per
> [semver](https://semver.org).
## Requirements
- PHP **8.5+**
- `symfony/http-client` (hard runtime dep — used as PSR-18 transport **and**
Symfony's `EventSourceHttpClient` for SSE log streaming)
- `nyholm/psr7` (PSR-7/17 implementation; no discovery, embedded as a default)
## Installation
## Documentation
Full reference under [`docs/`](docs/index.md):
- [Getting started](docs/getting-started.md) — install + first call
- [Authentication](docs/authentication.md) — API token (Bearer) + OAuth 1.0a
- [Configuration](docs/configuration.md) — `Configuration`, `RetryPolicy`, hooks, logging
- [Error handling](docs/errors.md) — typed exception hierarchy
- [Live log streaming](docs/logs-streaming.md) — Symfony SSE under the hood
- [Testing](docs/testing.md) — `MockHttpClient` patterns
- [Resource reference](docs/index.md#resource-reference) — one page per family
## Quick start
Mint your token from the [Clever Cloud Console](https://console.clever-cloud.com/) (section "Personal API tokens"), set it as `CC_API_TOKEN`, and you're done.
The SDK also supports OAuth 1.0a for legacy consumers and 3-legged authorisation flows - see [`docs/authentication.md`](docs/authentication.md) for the full picture.
## Coverage matrix
The SDK covers most of Clever Cloud's v2 + v4 surface, plus the api-bridge
gateway used for API tokens. Below is the actual coverage shipped in v2.0; what
is deliberately out of scope at this stage is listed in the "Roadmap" section.
### V2 — application platform
| Family | Methods on `$client->...` |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `self` | `get / update / sshKeys / addSshKey / removeSshKey / emailAddresses / addEmailAddress / removeEmailAddress / consumers / getConsumer / createConsumer / updateConsumer / deleteConsumer / startMfa / confirmMfa / disableMfa / regenerateMfaBackupCodes / changePassword` |
| `users` | `get / update / delete / applications / addons` |
| `organisations` | `list / get / create / update / delete / members / addMember / updateMember / removeMember / consumers / getConsumer / createConsumer / updateConsumer / deleteConsumer / namespaces` |
| `applications` | `list / get / create / update / delete / restart / stop / deploy / branches / setBranch / instances / dependencies / addDependency / removeDependency / tags / addTag / removeTag / exposedEnv / setExposedEnv / addons / linkAddon / unlinkAddon` |
| `addons` | `list / get / create / update / delete / providers / provider / plans / linkedApplications / env / sso / tags / addTag / removeTag / migrate / listMigrations / getMigration / cancelMigration / preorderMigration` |
| `deployments` | `list / get / cancel / instances` |
| `environment` | `list / get / set / setMany / remove` |
| `domains` | `list / get / add / remove / favourite / setFavourite / unsetFavourite` |
| `tcpRedirections` | `list / namespaces / add / remove` |
### V4 — platform extensions
| Family | Methods on `$client->...` |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `billing` | `getBalance / listInvoices / getInvoice / downloadInvoicePdf / paymentMethods / addPaymentMethod / removePaymentMethod / consumptions / recurrent` |
| `instances` | `list / get / flavors / types` |
| `loadBalancers` | `list / get / dnsInfo` |
| `products` | `instances / addonProviders / zones / countries` |
| `zones` | `list / get` |
| `pulsarPolicies` | `get / update / reset` |
| `logs` | `stream` (SSE → `LogStream
`) / `query` (historical) |
| `operators` | `.keycloak / .matomo / .metabase / .otoroshi` (each: `list / get / create / update / delete / reboot / rebuild`) |
| `drains` | `list / get / create / update / delete / enable / disable / restart` |
| `notifications` | `list / create / delete` (email hooks) |
| `webhooks` | `list / create / delete` |
| `networkGroups` | `list / get / create / delete / addMember / removeMember / externalPeerConfig` |
| `orchestration` | `instances / deployments` |
| `backups` | `list / get / restore` |
### Bridge — `api-bridge.clever-cloud.com`
| Family | Methods on `$client->...` |
| ------------- | ---------------------------------------- |
| `apiTokens` | `list / get / create / update / delete` |
### Enums
Stable, platform-wide enumerations live under `CleverCloud\Sdk\Model\Enum\`.
They give you autocomplete, parsing (`tryFrom()`), and `cases()` for populating
form selects without hardcoding string literals.
| Enum | Cases | Use it for |
| -------------------------- | ------------------------------------------------------------------------------------------ | --------------------------------------- |
| `Flavor` | `Pico Nano XS S M L XL XXL XXXL` (values `pico..3XL`) | Application instance sizes |
| `DeployType` | `Git Ftp Docker` | Application source delivery method |
| `ApplicationState` | `ShouldBeUp WantsToBeUp ShouldBeDown WantsToBeDown Restart RestartRequested RestartFailed Deploying DeploymentPending` (+ `isStable()` / `isTransient()`) | Application lifecycle |
| `MigrationStatus` | `Success InProgress Pending Failed Cancelled` (+ `isTerminal()`) | Add-on plan migration |
| `MemberRole` | `Admin Manager Developer Accounting` | Organisation membership |
| `DeploymentAction` | (see source) | Deployment lifecycle |
| `DeploymentState` | (see source) | Deployment outcome |
| `DrainType` | Datadog / ElasticSearch / NewRelic / OVH-TCP / Raw-HTTP / Syslog-TCP / Syslog-UDP | Log drain configuration |
| `WebhookFormat` | Raw / Slack / Gitter / Flowdock | Webhook payload format |
**Dynamic catalogues** (changes faster than SDK releases) are exposed via API
calls rather than PHP enums — they pick up new entries the moment Clever Cloud
ships them:
### Roadmap (not in v2.0)
- AI, Materia KV / TS, Cellar, Cumulocity, DNS, IPAM, Kubernetes, Function,
Container Registry — V4 endpoints unique to the Go SDK
- WebSocket events stream (parity with `clever-client.js` `EventsStream`)
- OpenTelemetry bridge
- Resource-ID resolver / ownerId cache
## Authentication
### API token (recommended)
Tokens are minted from the Console (or via `$client->apiTokens->create()` with
an existing OAuth 1.0a client). They go in `Credentials::apiToken()`, are sent as
`Authorization: Bearer `, and the `apiTokens` resource itself routes
to `api-bridge.clever-cloud.com` so the gateway can validate the scopes. Note
that the `apiTokens` resource **requires OAuth 1.0a authentication** - you cannot
manage tokens with a Bearer token.
### OAuth 1.0a (legacy)
Three-legged flow helper for the consumer + user token pattern:
## Configuration knobs
### Lifecycle hooks
`onRequest(Closure $hook): self` and `onResponse(Closure $hook): self` accept
multiple registrations and fire in order:
- **onRequest** receives a `Psr\Http\Message\RequestInterface` after URI / body
construction but **before** authentication is applied. Returning a modified
request swaps it for the rest of the pipeline (signing, retries, dispatch).
- **onResponse** receives `(ResponseInterface $response, RequestInterface $request)`
on every response, success or error. Read-only — return value ignored.
Typical uses: tracing-header propagation, latency histograms, request-ID
correlation to a log aggregator.
### PSR-3 log context keys
When a `LoggerInterface` is registered, the SDK emits the following keys (use
them in dashboards / log filters):
| Key | Level | Description |
| ----------- | ----- | ---------------------------------------------------------------------- |
| `attempt` | debug, warning | 1-based attempt counter inside the retry loop. |
| `method` | debug, warning, error | HTTP method. |
| `uri` | debug, warning, error | Final URI (after URI builder + query string). |
| `status` | debug, warning, error | HTTP status code. |
| `requestId` | debug | Server request ID from `X-Request-Id`, `Sozu-Id`, or `X-Sozu-Id`. |
| `delayMs` | warning | Sleep duration before next retry. |
| `exception` | warning, error | Exception class / message. |
Channel: `clevercloud-sdk` (string prefix on all log messages). Levels: `debug`
on every response, `warning` on retries (rate-limit + 5xx), `error` on the
terminal failure that raises an exception.
## Error handling
Everything the SDK throws implements `CleverCloud\Sdk\Exception\CleverCloudException`.
HTTP errors land in typed subclasses of `ApiException`:
| Status | Exception |
| -------------------- | ------------------------ |
| 401 / 403 | `AuthException` |
| 404 | `NotFoundException` |
| 400 / 422 + `errors` | `ValidationException` |
| 429 | `RateLimitException` |
| 5xx | `ServerException` |
| other 4xx | `ApiException` |
| PSR-18 transport | `TransportException` |
| bad SDK config | `ConfigurationException` |
All `ApiException`s carry `$statusCode`, `$errorCode`, `$requestId`, and the
decoded `$body`. `ValidationException` adds a `field => list` map,
`RateLimitException` adds `$retryAfterSeconds`.
## Testing your code against the SDK
The SDK's transport is `symfony/http-client`. Inject a `MockHttpClient` and
you get full control over what each call returns, with zero network IO:
See `examples/mocking.php` for a runnable example.
## License
[MIT](LICENSE) All versions of clevercloud-php-sdk with dependencies
PHP Build Version
8.0.21 7.3.33
Package Version
v2.0.0
v1.0.0
Composer command for our command line client (download client )
This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free.
Standard composer command
The package welcomattic/clevercloud-php-sdk contains the following files Loading the files please wait ...