typhonius/acquia-php-sdk-v2

A PHP SDK for Acquia CloudAPI v2

1.0.4 2019-07-17 10:42 UTC

README

Build Status Total Downloads Coverage Status License

Latest Stable Version Latest Unstable Version

With the original Acquia Cloud SDK being deprecated and a new version of Cloud API being made available, this SDK aims to fill the gap and use more modern PHP packages to allow developers to continue to build tools that interact with the Acquia Cloud API.

Installation

The SDK can be installed with Composer by adding this library as a dependency to your composer.json file.

{
    "require": {
        "typhonius/acquia-php-sdk-v2": "^1.0.0"
    }
}

Generating an API access token

To generate an API access token, login to https://cloud.acquia.com, then visit https://cloud.acquia.com/#/profile/tokens, and click Create Token.

  • Provide a label for the access token, so it can be easily identified. Click Create Token.
  • The token has been generated, copy the api key and api secret to a secure place. Make sure you record it now: you will not be able to retrieve this access token's secret again.

Usage

Basic usage examples for the SDK.

<?php

require 'vendor/autoload.php';

use AcquiaCloudApi\CloudApi\Client;
use AcquiaCloudApi\CloudApi\Connector;

$key = 'd0697bfc-7f56-4942-9205-b5686bf5b3f5';
$secret = 'D5UfO/4FfNBWn4+0cUwpLOoFzfP7Qqib4AoY+wYGsKE=';

$config = [
    'key' => $key,
    'secret' => $secret,
];
$connector = new Connector($config);
$cloudapi = Client::factory($connector);

// Get all applications.
$applications = $cloudapi->applications();

// Get all environments of an application.
$environments = $cloudapi->environments($application->uuid);

// Get all servers in an environment.
$servers = $cloudapi->servers($environment->uuid);

I just want to talk to the API without having to write code

The Acquia Cli Robo application creates a command line tool for communicating with the API using this SDK. Its purpose is to provide a simple mechanism for interacting with the API without having to write a line of code.