PHPackages                             platformsh/client - 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. platformsh/client

ActiveLibrary[API Development](/categories/api)

platformsh/client
=================

Platform.sh API client

2.5.1(4y ago)29347.9k↓18.2%31[7 issues](https://github.com/platformsh/platformsh-client-php/issues)[12 PRs](https://github.com/platformsh/platformsh-client-php/pulls)3MITPHPPHP &gt;=7.1.0CI failing

Since Mar 25Pushed 1w ago10 watchersCompare

[ Source](https://github.com/platformsh/platformsh-client-php)[ Packagist](https://packagist.org/packages/platformsh/client)[ RSS](/packages/platformsh-client/feed)WikiDiscussions 3.x Synced 2d ago

READMEChangelogDependencies (4)Versions (284)Used By (3)

Platform.sh API client
======================

[](#platformsh-api-client)

This is a PHP library for accessing the Platform.sh API.

We recommend you use the [Platform.sh CLI](https://github.com/platformsh/cli) (which uses this library) for most purposes.

### Versions

[](#versions)

- The `3.x` branch (major version 3) requires PHP 8.2 and above.
- The `2.x` branch (major version 2) requires PHP 7.2.5 and above. This branch is no longer maintained.
- The `1.x` branch (any version &lt; 2) supports PHP 5.5.9 and above, and uses Guzzle 5. Old PHP versions are supported by the [Platform.sh CLI](https://github.com/platformsh/platformsh-cli), which is why this branch is still maintained.

Install
-------

[](#install)

```
composer require platformsh/client
```

Usage
-----

[](#usage)

Example:

```
use Platformsh\Client\Connection\Connector;
use Platformsh\Client\PlatformClient;

// Set up configuration.
$connector = new Connector([
    'api_url' => 'https://api.platform.sh',
    'accounts' => 'https://api.platform.sh/',
    'centralized_permissions_enabled' => true,
]);

// Initialize the client.
$client = new PlatformClient();

// Set the API token to use.
//
// N.B. you must keep your API token(s) safe!
$client->getConnector()->setApiToken($myToken, 'exchange');

// Get a project.
$project = $client->getProject('my_project_id');
if ($project) {
    // Get the default (production) environment.
    $environment = $project->getEnvironment($project->default_branch);

    // Create a new environment.
    $result = $environment->runOperation('branch', body: ['name' => 'sprint-1', 'title' => 'Sprint 1']);

    // Wait for the operation to complete.
    $activities = $result->getActivities();
    while (count($activities) > 0) {
        foreach ($activities as $key => $activity) {
            if ($activity->isComplete() || $activity->state === \Platformsh\Client\Model\Activity::STATE_CANCELLED) {
                unset($activities[$key]);
            } else {
                echo "Waiting for the activity: {$activity->getDescription()}\n";
                $activity->wait(function () { echo '.'; });
                echo "\n";
            }
        }
    }

    // Get the new branch.
    $sprint1 = $project->getEnvironment('sprint-1');
}
```

Creating a project:

```
use \Platformsh\Client\Model\Subscription\SubscriptionOptions;

$subscription = $client->createSubscription(SubscriptionOptions::fromArray([
    'project_region' => 'uk-1.platform.sh',
    'project_title' => 'My project',
    'plan' => 'development',
    'default_branch' => 'main',
]));

echo "Created subscription $subscription->id, waiting for it to activate...\n";

$subscription->wait();

$project = $subscription->getProject();

echo "The project is now active: $project->id\n";
echo "Git URI: " . $project->getGitUrl() . "\n";
```

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance59

Moderate activity, may be stable

Popularity49

Moderate usage in the ecosystem

Community31

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 96.2% 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 ~15 days

Recently: every ~37 days

Total

265

Last Release

106d ago

Major Versions

0.65.0 → 2.6.0-beta32022-10-04

0.87.0 → 2.x-dev2024-11-25

2.x-dev → 3.0.0-beta12024-11-25

0.90.0 → 1.x-dev2025-09-17

0.91.0 → 3.0.0-beta22025-10-19

PHP version history (5 changes)2.0.0-beta.0PHP &gt;=5.6.0

v0.25.1PHP &gt;=5.5.9

2.0.0PHP &gt;=7.1.0

2.6.0-beta1PHP &gt;=7.2.5

3.0.0-beta1PHP &gt;=8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1465106?v=4)[Patrick Dawkins](/maintainers/pjcdawkins)[@pjcdawkins](https://github.com/pjcdawkins)

---

Top Contributors

[![pjcdawkins](https://avatars.githubusercontent.com/u/1465106?v=4)](https://github.com/pjcdawkins "pjcdawkins (632 commits)")[![shawnawsu](https://avatars.githubusercontent.com/u/24374002?v=4)](https://github.com/shawnawsu "shawnawsu (3 commits)")[![vitolkachova](https://avatars.githubusercontent.com/u/208131540?v=4)](https://github.com/vitolkachova "vitolkachova (3 commits)")[![Kingdutch](https://avatars.githubusercontent.com/u/327697?v=4)](https://github.com/Kingdutch "Kingdutch (3 commits)")[![acrollet](https://avatars.githubusercontent.com/u/101649?v=4)](https://github.com/acrollet "acrollet (2 commits)")[![ralt](https://avatars.githubusercontent.com/u/1016379?v=4)](https://github.com/ralt "ralt (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![bbujisic](https://avatars.githubusercontent.com/u/1785801?v=4)](https://github.com/bbujisic "bbujisic (2 commits)")[![vrobert78](https://avatars.githubusercontent.com/u/15088490?v=4)](https://github.com/vrobert78 "vrobert78 (1 commits)")[![bart-van-amelsvoort](https://avatars.githubusercontent.com/u/3480110?v=4)](https://github.com/bart-van-amelsvoort "bart-van-amelsvoort (1 commits)")[![Crell](https://avatars.githubusercontent.com/u/254863?v=4)](https://github.com/Crell "Crell (1 commits)")[![Kazanir](https://avatars.githubusercontent.com/u/4731136?v=4)](https://github.com/Kazanir "Kazanir (1 commits)")[![kksandr7](https://avatars.githubusercontent.com/u/132560756?v=4)](https://github.com/kksandr7 "kksandr7 (1 commits)")[![miguelsanchez-upsun](https://avatars.githubusercontent.com/u/258854299?v=4)](https://github.com/miguelsanchez-upsun "miguelsanchez-upsun (1 commits)")[![NitriKx](https://avatars.githubusercontent.com/u/1231438?v=4)](https://github.com/NitriKx "NitriKx (1 commits)")[![ricardokirkner](https://avatars.githubusercontent.com/u/478971?v=4)](https://github.com/ricardokirkner "ricardokirkner (1 commits)")

---

Tags

api-clientphp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/platformsh-client/health.svg)

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

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M572](/packages/shopware-core)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[avalara/avataxclient

Client library for Avalara's AvaTax suite of business tax calculation and processing services. Uses the REST v2 API.

528.5M7](/packages/avalara-avataxclient)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)

PHPackages © 2026

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