platformsh/client API client

2.1.0 2019-08-07 14:03 UTC


This is a PHP library for accessing the API.

We recommend you use the CLI (which uses this library) for most purposes.

Build Status


composer require platformsh/client



use Platformsh\Client\PlatformClient;

// 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 the user's first project.
$projects = $client->getProjects();
if ($projects) {
    $firstProject = reset($projects);

    // Get the master environment.
    $master = $firstProject->getEnvironment('master');

    // Branch the master environment.
    $activity = $master->branch('Sprint 1', 'sprint-1');

    // Wait for the activity to complete.

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