1. Go to this page and download the library: Download acquia/acquia-sdk-php 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/ */
acquia / acquia-sdk-php example snippets
use Acquia\Cloud\Api\CloudApiClient;
$cloudapi = CloudApiClient::factory(array(
'username' => 'xxx...', // Email address used to log into the Acquia Network
'password' => 'xxx...', // Acquia Network password
));
$sites = $cloudapi->sites();
use Acquia\Network\AcquiaNetworkClient;
use Acquia\Common\Services;
$network = AcquiaNetworkClient::factory(array(
'network_id' => 'XXXX-XXXXX', // Acquia Network identifier
'network_key' => 'xxxxxx...', // Acquia Network key
));
// Enable Acquia Search and return index information.
$acquiaServices = Services::ACQUIA_SEARCH;
$subscription = $network->checkSubscription($acquiaServices);
print $subscription->getDashboardUrl();
use Acquia\Search\AcquiaSearchService;
// A subscription can have multiple indexes. The Acquia Search service builder
// generates credentials and clients for all of the subscription's indexes.
$search = AcquiaSearchService::factory($subscription);
$index = $search->get('XXXX-XXXXX');
$results = $index->select('my keywords');
use Acquia\Cloud\Database\DatabaseService;
$service = new DatabaseService();
$creds = $service->credentials('mydatabase');
$dbh = new PDO($creds, $creds->username(), $creds->password());
use Acquia\Cloud\Database\DatabaseService;
use Acquia\Cloud\Environment\LocalEnvironment;
// "mydatabase" is the name of the database on Acquia Cloud.
$environment = new LocalEnvironment('mysite');
$environment->addDatabaseCredentials('mydatabase', 'local_db_name', 'db_user', 'db_password');
$service = new DatabaseService($environment);
$creds = $service->credentials('mydatabase');
$dbh = new PDO($creds, $creds->username(), $creds->password());
use Acquia\Cloud\Memcache\MemcacheService;
$service = new MemcacheService();
$memcache = new \Memcache();
$creds = $service->credentials();
foreach ($creds as $server) {
$memcache->addServer($server->host(), $server->port());
}
use Acquia\Cloud\Memcache\MemcacheService;
use Acquia\Cloud\Environment\LocalEnvironment;
$environment = new LocalEnvironment('mysite');
$environment->addMemcacheCredentials('localhost', 11211);
$service = new MemcacheService(environment);
$memcache = new \Memcache();
$creds = $service->credentials();
foreach ($creds as $server) {
$memcache->addServer($server->host(), $server->port());
}