1. Go to this page and download the library: Download typhonius/acquia-php-sdk-v2 library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
typhonius / acquia-php-sdk-v2 example snippets
cquiaCloudApi\Connector\Client;
use AcquiaCloudApi\Connector\Connector;
use AcquiaCloudApi\Endpoints\Applications;
use AcquiaCloudApi\Endpoints\Environments;
use AcquiaCloudApi\Endpoints\Servers;
use AcquiaCloudApi\Endpoints\DatabaseBackups;
use AcquiaCloudApi\Endpoints\Variables;
use AcquiaCloudApi\Endpoints\Account;
$key = 'd0697bfc-7f56-4942-9205-b5686bf5b3f5';
$secret = 'D5UfO/4FfNBWn4+0cUwpLOoFzfP7Qqib4AoY+wYGsKE=';
$config = [
'key' => $key,
'secret' => $secret,
];
$connector = new Connector($config);
$client = Client::factory($connector);
$application = new Applications($client);
$environment = new Environments($client);
$server = new Servers($client);
$backup = new DatabaseBackups($client);
$variable = new Variables($client);
$account = new Account($client);
// Get all applications.
$applications = $application->getAll();
// Get all environments of an application.
$environments = $environment->getAll($applicationUuid);
// Get all servers in an environment.
$servers = $server->getAll($environmentUuid);
// Create DB backup
$backup->create($environmentUuid, $dbName);
// Set an environment varible
$variable->create($environmentUuid, 'test_variable', 'test_value');
// Download Drush 9 aliases to a temp directory
$client->addQuery('version', '9');
$result = $account->getDrushAliases();
$drushArchive = tempnam(sys_get_temp_dir(), 'AcquiaDrushAliases') . '.tar.gz';
file_put_contents($drushArchive, $aliases, LOCK_EX);
// Download database backup
// file_put_contents loads the response into memory. This is okay for small things like Drush aliases, but not for database backups.
// Use curl.options to stream data to disk and minimize memory usage.
$client->addOption('sink', $filepath);
$client->addOption('curl.options', ['CURLOPT_RETURNTRANSFER' => true, 'CURLOPT_FILE' => $filepath]);
$backup->download($environmentUuid, $dbName, $backupId);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.