PHPackages                             acquia/acquia-sdk-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. acquia/acquia-sdk-php

Abandoned → [typhonius/acquia-php-sdk-v2](/?search=typhonius%2Facquia-php-sdk-v2)ArchivedLibrary[API Development](/categories/api)

acquia/acquia-sdk-php
=====================

The Acquia SDK for PHP allows developers to build applications on top of Acquia services.

0.10.8(10y ago)2358.2k20[11 issues](https://github.com/acquia/acquia-sdk-php/issues)[6 PRs](https://github.com/acquia/acquia-sdk-php/pulls)MITPHPPHP &gt;=5.3.0

Since Dec 16Pushed 4y ago16 watchersCompare

[ Source](https://github.com/acquia/acquia-sdk-php)[ Packagist](https://packagist.org/packages/acquia/acquia-sdk-php)[ Docs](https://github.com/acquia/acquia-sdk-php)[ RSS](/packages/acquia-acquia-sdk-php/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (13)Versions (23)Used By (0)

NOTE: This repository is no longer actively maintained and has not been updated to support PHP 7.1
--------------------------------------------------------------------------------------------------

[](#note-this-repository-is-no-longer-actively-maintained-and-has-not-been-updated-to-support-php-71)

Instead, please upgrade to [typhonius/acquia-php-sdk-v2](https://github.com/typhonius/acquia-php-sdk-v2).

Acquia SDK for PHP
==================

[](#acquia-sdk-for-php)

[![Build Status](https://camo.githubusercontent.com/20e32a6ac9cb3c368f53554c039675cce142be49b85e89e358def2e4311adfaf/68747470733a2f2f7472617669732d63692e6f72672f6163717569612f6163717569612d73646b2d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/acquia/acquia-sdk-php)[![Code Coverage](https://camo.githubusercontent.com/8da439273c25cba0f698f049a4ff3f47d33e59875dde3f6d1bc4c656715a3d3e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6163717569612f6163717569612d73646b2d7068702f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/acquia/acquia-sdk-php/?branch=master)[![HHVM Status](https://camo.githubusercontent.com/9e2692bf340dbd3778039ad95f76c35600cf730f3a403853da4d72054477d288/687474703a2f2f6868766d2e683463632e64652f62616467652f6163717569612f6163717569612d73646b2d7068702e737667)](http://hhvm.h4cc.de/package/acquia/acquia-sdk-php)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/7ec1504bc7b069f0afef49670728e78f97d56fa752a082e1e49403f0c7268e47/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6163717569612f6163717569612d73646b2d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/acquia/acquia-sdk-php/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/04784602266b2ffc35f8432d6e9c758f4cc9cae0cc7b427f94eb9065c2e0d11f/68747470733a2f2f706f7365722e707567782e6f72672f6163717569612f6163717569612d73646b2d7068702f762f737461626c652e706e67)](https://packagist.org/packages/acquia/acquia-sdk-php)[![License](https://camo.githubusercontent.com/6d1a7a3236f00af8f7b79221dc98c167263ed7ee11f2a54dffd4e8402c8780cc/68747470733a2f2f706f7365722e707567782e6f72672f6163717569612f6163717569612d73646b2d7068702f6c6963656e73652e737667)](https://packagist.org/packages/acquia/acquia-sdk-php)

The Acquia SDK for PHP allows developers to [build](https://www.youtube.com/watch?v=8wDSj18sXbg)applications on top of [Acquia](https://www.acquia.com/) services.

Acquia provides open cloud hosting, developer tools and world-class support for Drupal, the open source content management platform that unifies content, community and commerce.

Installation
------------

[](#installation)

The SDK can be installed with [Composer](http://getcomposer.org) by adding this library as a dependency to your composer.json file.

```
{
    "require": {
        "acquia/acquia-sdk-php": "*"
    }
}
```

After running `php composer.phar update` on the command line, include the autoloader in your PHP scripts so that the SDK classes are made available.

```
require_once 'vendor/autoload.php';
```

#### Take Only What You Need

[](#take-only-what-you-need)

Instead of downloading the entire SDK, it is recommended to take only what you need by requiring the individual components you intend to use. For example, the following code requires the Acquia Search component and it's dependencies.

```
{
    "require": {
        "acquia/acquia-sdk-php-search": "*"
    }
}
```

The following components are available:

- [acquia/acquia-sdk-php-cloud-api](https://packagist.org/packages/acquia/acquia-sdk-php-cloud-api) Cloud API client library
- [acquia/acquia-sdk-php-cloud-db](https://packagist.org/packages/acquia/acquia-sdk-php-cloud-db) Returns credentials for the active master database on Acquia Cloud
- [acquia/acquia-sdk-php-cloud-memcache](https://packagist.org/packages/acquia/acquia-sdk-php-cloud-memcache) Returns credentials for the memcache servers on Acquia Cloud
- [acquia/acquia-sdk-php-cloud-env](https://packagist.org/packages/acquia/acquia-sdk-php-cloud-env) Provides context about the Acquia Cloud environment
- [acquia/acquia-sdk-php-common](https://packagist.org/packages/acquia/acquia-sdk-php-common) SDK version and constants that denote Acquia Services
- [acquia/acquia-sdk-php-env](https://packagist.org/packages/acquia/acquia-sdk-php-env) Allows applications to add context about the environment they are running in
- [acquia/acquia-sdk-php-json](https://packagist.org/packages/acquia/acquia-sdk-php-json) Utility methods to work with JSON
- [acquia/acquia-sdk-php-network](https://packagist.org/packages/acquia/acquia-sdk-php-network) Acquia Network client library
- [acquia/acquia-sdk-php-rest](https://packagist.org/packages/acquia/acquia-sdk-php-rest) Utility methods for consuming REST-like APIs
- [acquia/acquia-sdk-php-search](https://packagist.org/packages/acquia/acquia-sdk-php-search) Acquia Search client library

Usage
-----

[](#usage)

Basic usage examples for the SDK.

### Cloud API

[](#cloud-api)

The [Cloud API](https://docs.acquia.com/cloud/api) is a web service that that developers can use to extend, enhance, and customize [Acquia Cloud](https://www.acquia.com/products-services/acquia-cloud).

```
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();
```

### Acquia Network

[](#acquia-network)

The [Acquia Network](https://www.acquia.com/products-services/drupal-support-and-cloud-services)is a comprehensive suite of tools to help you create and manage killer web sites, backed by the best Drupal support team in the world.

```
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();
```

### Acquia Search

[](#acquia-search)

[Acquia Search](https://www.acquia.com/products-services/acquia-network/cloud-services/acquia-search)is a fully managed enterprise site search solution built on Apache Solr and other open source technologies.

```
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');
```

Refer to the [PSolr](https://github.com/cpliakas/psolr) project's documentation for more advanced usage examples.

*Recommended*: Use the Service Manager to store credentials so that you don't have to query the Acquia Network on every search request.

### Acquia Cloud Database

[](#acquia-cloud-database)

The Database component allows developers to connect to the active master database when running applications on [Acquia Cloud](https://www.acquia.com/products-services/acquia-cloud).

```
use Acquia\Cloud\Database\DatabaseService;

$service = new DatabaseService();

$creds = $service->credentials('mydatabase');
$dbh = new PDO($creds, $creds->username(), $creds->password());
```

#### Local Development

[](#local-development)

The SDK facilitates code portability for developers who like to test their application locally. The following snippet shows how to connect to a local database.

```
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());
```

### Acquia Cloud Memcache

[](#acquia-cloud-memcache)

The Memcache component allows developers to connect to the [Memcached](http://memcached.org/)caching system when running applications on [Acquia Cloud](https://www.acquia.com/products-services/acquia-cloud).

```
use Acquia\Cloud\Memcache\MemcacheService;

$service  = new MemcacheService();
$memcache = new \Memcache();

$creds = $service->credentials();
foreach ($creds as $server) {
    $memcache->addServer($server->host(), $server->port());
}
```

#### Local Development

[](#local-development-1)

The SDK facilitates code portability for developers who like to test their application locally. The following snippet shows how to connect to a local memcache server.

```
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());
}
```

Refer to the [Memcache PECL](http://us2.php.net/manual/en/book.memcache.php)project's documentation for more details.

The Acquia Service Manager
--------------------------

[](#the-acquia-service-manager)

The Acquia Service Manager simplifies credential management and client instantiation. The credential management system is built using [Guzzle's service builder](http://docs.guzzlephp.org/en/latest/webservice-client/using-the-service-builder.html)subsystem, so the documentation and techniques can also apply here.

### Saving Credentials

[](#saving-credentials)

The following example saves the configurations for the client to JSON files in the specified directory. Note that the Acquia Search client is a service builder which is why we use the `setBuilder` method for it.

```
use Acquia\Rest\ServiceManager;

$services = new ServiceManager(array(
    'conf_dir' => '/path/to/conf/dir',
));

$services
    ->setClient('cloudapi', 'mysite', $cloudapi)
    ->setClient('network', 'XXXX-XXXXX', $network)
    ->setBuilder('search', $search)
;

$services->save();
```

### Instantiating Service Clients

[](#instantiating-service-clients)

Clients can now be instantiated from the service manager by passing the service group (e.g. "network", "search", etc.) and service name defined in the `setClient()` method. For Acquia Search, the service builder automatically names the clients after their index identifiers.

```
use Acquia\Rest\ServiceManager;

$services = new ServiceManager(array(
    'conf_dir' => '/path/to/conf/dir',
));

$cloudapi = $services->getClient('cloudapi', 'mysite');
$network = $services->getClient('network', 'XXXX-XXXXX');
$index = $services->getClient('search', 'XXXX-XXXXX');
```

Contributing and Development
----------------------------

[](#contributing-and-development)

Submit changes using GitHub's standard [pull request](https://help.github.com/articles/using-pull-requests) workflow.

All code should adhere to the following standards:

- [PSR-0](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md)
- [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md)
- [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)

It is recommend to use the [PHP Coding Standards Fixer](https://github.com/fabpot/PHP-CS-Fixer)tool to ensure that code adheres to the coding standards mentioned above.

Refer to [PHP Project Starter's documentation](https://github.com/cpliakas/php-project-starter#using-apache-ant)for the Apache Ant targets supported by this project.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community26

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~35 days

Recently: every ~76 days

Total

22

Last Release

3788d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0e8969114e0f3bdd130d021357e5003be19cb0517fa3507eb6c429b020f06f16?d=identicon)[jfarrell](/maintainers/jfarrell)

---

Top Contributors

[![cpliakas](https://avatars.githubusercontent.com/u/482722?v=4)](https://github.com/cpliakas "cpliakas (25 commits)")[![webbj74-acquia](https://avatars.githubusercontent.com/u/71830038?v=4)](https://github.com/webbj74-acquia "webbj74-acquia (21 commits)")[![webbj74](https://avatars.githubusercontent.com/u/50980?v=4)](https://github.com/webbj74 "webbj74 (8 commits)")[![weitzman](https://avatars.githubusercontent.com/u/7740?v=4)](https://github.com/weitzman "weitzman (4 commits)")[![jacobbednarz](https://avatars.githubusercontent.com/u/283234?v=4)](https://github.com/jacobbednarz "jacobbednarz (3 commits)")[![daphneacquia](https://avatars.githubusercontent.com/u/5854785?v=4)](https://github.com/daphneacquia "daphneacquia (2 commits)")[![deviantintegral](https://avatars.githubusercontent.com/u/255023?v=4)](https://github.com/deviantintegral "deviantintegral (2 commits)")[![eporama](https://avatars.githubusercontent.com/u/178637?v=4)](https://github.com/eporama "eporama (2 commits)")[![lahoosascoots](https://avatars.githubusercontent.com/u/3409685?v=4)](https://github.com/lahoosascoots "lahoosascoots (2 commits)")[![Zlender](https://avatars.githubusercontent.com/u/104882?v=4)](https://github.com/Zlender "Zlender (1 commits)")[![bjeavons](https://avatars.githubusercontent.com/u/94468?v=4)](https://github.com/bjeavons "bjeavons (1 commits)")[![IlyaPokamestov](https://avatars.githubusercontent.com/u/2771864?v=4)](https://github.com/IlyaPokamestov "IlyaPokamestov (1 commits)")[![jakubsuchy](https://avatars.githubusercontent.com/u/234124?v=4)](https://github.com/jakubsuchy "jakubsuchy (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")[![smatyas](https://avatars.githubusercontent.com/u/534550?v=4)](https://github.com/smatyas "smatyas (1 commits)")[![aaronpacheco](https://avatars.githubusercontent.com/u/1394389?v=4)](https://github.com/aaronpacheco "aaronpacheco (1 commits)")

---

Tags

acquia

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/acquia-acquia-sdk-php/health.svg)

```
[![Health](https://phpackages.com/badges/acquia-acquia-sdk-php/health.svg)](https://phpackages.com/packages/acquia-acquia-sdk-php)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[phpdocumentor/phpdocumentor

Documentation Generator for PHP

4.4k3.1M878](/packages/phpdocumentor-phpdocumentor)[temporal/sdk

Temporal SDK

4002.2M18](/packages/temporal-sdk)[keboola/storage-api-client

Keboola Storage API PHP Client

10387.5k25](/packages/keboola-storage-api-client)[worksome/graphlint

A static analysis tool for GraphQL

13189.4k](/packages/worksome-graphlint)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
