Skip to content

Instantly share code, notes, and snippets.

@lnunesbr
Created April 14, 2020 18:25
Show Gist options
  • Save lnunesbr/b03e202e565c3e92d541ffecdcd9525e to your computer and use it in GitHub Desktop.
Save lnunesbr/b03e202e565c3e92d541ffecdcd9525e to your computer and use it in GitHub Desktop.
<?php
//readme:
//run `composer require typhonius/acquia-php-sdk-v2:^2.0`
//adjust vars $key, $secret, $app_uuid, $env_name
//run in terminal `php acquia_environments.php`
require "vendor/autoload.php";
// @file get acquia application environment per field name
use AcquiaCloudApi\Connector\Client;
use AcquiaCloudApi\Connector\Connector;
use AcquiaCloudApi\Response\EnvironmentsResponse;
//setup $key and $secret creds from Acquia
//https://docs.acquia.com/acquia-cloud/develop/api/auth/#generating-an-api-token
$key = '99999-999999-999999-9999';
$secret = 'XXXXXXLLLLLLSSSSSQQQQQQ';
//define application acquia uuid
//
$app_uuid = "99999-999999-999999-9999";
$env_name = "dev5";
$config = [
'key' => $key,
'secret' => $secret,
];
$connector = new Connector($config);
$client = Client::factory($connector);
$client->addQuery('filter', ["name=@{$env_name}"]);
$client->addOption('debug', true);
$resp = new EnvironmentsResponse(
$client->request(
'GET',
"/applications/{$app_uuid}/environments"
)
);
var_dump($resp);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment