pjcdawkins / platformsh-client-php

Platform.sh API client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Platform.sh API client

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

Install

Add this requirement to your composer.json file:

    "require": {
        "platformsh/client": "@beta"
    }

Usage

Example:

use Platformsh\Client\PlatformClient;

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

// Set the API token to use.
$connector = $client->getConnector();
$connector->setApiToken($myToken);

// Get the user's first project.
$projects = $client->getProjects();
if ($projects) {
    $firstProject = $projects[0];

    // 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.
    $activity->wait();

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

About

Platform.sh API client


Languages

Language:PHP 100.0%