PHPackages                             adobe-marketing-cloud/marketing-cloud-php-sdk - 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. adobe-marketing-cloud/marketing-cloud-php-sdk

ActiveLibrary[API Development](/categories/api)

adobe-marketing-cloud/marketing-cloud-php-sdk
=============================================

An Object Oriented wrapper for the Adobe Marketing Cloud APIs

2.1.2(8y ago)37268.6k—5.2%27[1 issues](https://github.com/Adobe-Marketing-Cloud/marketing-cloud-php-sdk/issues)[1 PRs](https://github.com/Adobe-Marketing-Cloud/marketing-cloud-php-sdk/pulls)1MITPHPPHP &gt;=5.3

Since May 23Pushed 6y ago27 watchersCompare

[ Source](https://github.com/Adobe-Marketing-Cloud/marketing-cloud-php-sdk)[ Packagist](https://packagist.org/packages/adobe-marketing-cloud/marketing-cloud-php-sdk)[ Docs](http://github.com/Adobe-Marketing-Cloud/marketing-cloud-php-sdk)[ RSS](/packages/adobe-marketing-cloud-marketing-cloud-php-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (9)Used By (1)

Adobe Marketing Cloud PHP SDK
=============================

[](#adobe-marketing-cloud-php-sdk)

[![Build Status](https://camo.githubusercontent.com/b71aa722e1a5b947d8b1a0f8c84d6c71613da36d48b7cbb549c53d957021d34b/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f41646f62652d4d61726b6574696e672d436c6f75642f6d61726b6574696e672d636c6f75642d7068702d73646b2e706e67)](http://travis-ci.org/Adobe-Marketing-Cloud/marketing-cloud-php-sdk)

A simple, Object Oriented wrapper for the Adobe Marketing Cloud APIs written in PHP5. This library is modeled after the [php-github-api](https://github.com/ornicar/php-github-api) library built by [ornicar](https://github.com/ornicar)

Uses the [Adobe Marketing Cloud APIs](https://marketing.adobe.com/developer/documentation). Default version is 1.4, but 1.3 and 1.2 are compatible.

Requires

- PHP 5.3 or higher
- [php curl](http://php.net/manual/en/book.curl.php) but it is possible to write another transport layer..

If the method you need does not exist yet, don't hesitate to request it with an [issue](http://github.com/Adobe-Digital-Marketing/adobe-digital-marketing-php-sdk/issues)!

Autoload
--------

[](#autoload)

The first step to use include the library via composer:

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

```

Instantiate a new AdobeMarketingCloud Client
--------------------------------------------

[](#instantiate-a-new-adobemarketingcloud-client)

```
$adm = new AdobeMarketingCloud\Client();

```

From this object you can now access all of the different AdobeMarketingCloud APIs (listed below)

### Authenticate a user

[](#authenticate-a-user)

Authenticate using your Adobe Digital Marketing Web Services username and secret. You can obtain one by logging into the [Marketing Cloud](https://my.omniture.com) and browsing to **Admin** &gt; **Company** &gt; **Web Services**

```
$adm->authenticate($username, $secret);

```

**Note**: If authentication fails, it's probably because your company endpoint is different from the default. To verify, this, call the `getEndpoint()` method:

```
echo $adm->getCompanyApi()->getEndpoint('My Company Name');
// "https://api2.omniture.com"

```

If the return value of this function is different from *https:api.omniture.com*, you will need to set the endpoint in your client

```
$adm->setEndpoint('https://api2.omniture.com');

```

### Deauthenticate a user

[](#deauthenticate-a-user)

Cancels authentication.

```
$adm->deAuthenticate();

```

Next requests will not be authenticated

Reports
-------

[](#reports)

For queueing SiteCatalyst reports Wraps [SiteCatalyst Report API](https://marketing.adobe.com/developer/documentation/sitecatalyst-reporting/c-overview-1).

```
$reportApi = $adm->getReportApi();

```

### Run a Ranked Report

[](#run-a-ranked-report)

```
$response = $reportApi->queueReport(array(
    'reportSuiteID' => 'your-id',
    'date'     => date('Y-m-d'),
    'metrics'  => array(
        array('id' => 'pageviews'),
    ),
    'elements' => array(
        array('id' => 'eVar1'),
    ),
));

print_r($response);

```

The above code will render the status of your queued report, which will look something like this:

```
Array
(
  [status]    => ready
  [statusMsg] => Your report has been queued
  [reportID] => 123456789
)

```

### Retrieve a Queued Report

[](#retrieve-a-queued-report)

Once the report ID is retrieved for the trended, ranked, or overtime report, use the Report.GetReport API call to retrieve the report

```
$response = $reportApi->queueReport(array(
    //... (see above)
));

$reportId = $response['reportID'];

do {
    $report = $reportApi->getReport($reportId);
    sleep(2);
} while ($report['status'] == 'not ready');

print_r($report['report']);

```

The above code will render the Report array, which will look something like this:

```
Array
(
    [reportSuite] => Array (
        [id]      => your-id
        [name]    => Your Report Suite
    )
    [period]      => "Mon. 16 July 2012",
    [elements]    => Array (
        [id]      => eVar2,
        [name]    => eVar 2
    )
    [metrics]     => Array (
        [id]      => event2
        [name]    => Page View Event
        [type]    => number
    )
    [type]        => trended
    [data]        => Array (
        ...
    )
    [totals]      => Array (
        ...
    )
)

```

Returns an array of results as described in [the documentation](https://marketing.adobe.com/developer/documentation/analytics-reporting-1-4/r-queue)

Calling Additional Methods
--------------------------

[](#calling-additional-methods)

All the methods visible in the [API Explorer](https://developer.omniture.com/en_US/get-started/api-explorer) can be called using the `SuiteApi` class. This is a generic class that accepts the method name and parameters, and will return the json encoded response of the result.

```
$adm->getSuiteApi()->post('Saint.ExportCreateJob', $parameters);

```

Curl Debugging
--------------

[](#curl-debugging)

If a request returns null, call the `getLastResponse` method on the client in order to see the curl information and raw response:

```
if (!$response = $adm->getReportApi()->getReport($reportId)) {
  print_r($adm->getLastResponse());
}

```

Passing in the debug flag to the HttpClient will output the response automatically when the response does not exist, or is not in json format

```
$adm = new AdobeMarketingCloud\Client(
  new AdobeMarketingCloud\HttpClient\Curl(array('debug' => true))
);

```

Command Line Utility
--------------------

[](#command-line-utility)

> OAuth is not yet available for production use. This functionality is still under development.

The easiest way to begin with OAuth is by using the command line utility tool (`bin/adm`).

To get started, copy over the configuration file:

```
$ cp config/profile.json.dist config/profile.json

```

Once this is done, run the `adm` command to get started

```
$ ./bin/amc

Calls the Adobe Marketing Cloud APIs
To get started, call

    $ amc authorize

to retrieve a token.  Some other options available are

 -h, --help      Display a help message and exit
 -v, --version   Display the current api version
 -e, --endpoint  Specify the api endpoint

See developer.omniture.com for more information

```

The first step will be to get an oauth token. This can be accomplished by providing the `authorize` command with a client id, client secret, username and password. Client IDs can be created in the [Developer Connection](https://developer.omniture.com/en_US/devcenter/applications). Once you've done this, run the `authorize` command to receive a token:

```
$ adm authorize CLIENT_ID CLIENT_SECRET USERNAME PASSWORD
Token: {
  "access_token":"f9f071ca2c25d23eff01a1ea238d6f85666be0f6",
  "expires_in":2592000,
  "token_type":"bearer",
  "scope":null,
  "success":true
}

```

You've now received your first access token. This has been saved to `config/profile.json`, so you don't need to worry about it. You can go ahead and start making requests!

```
$ adm request Company.GetReportSuites
Array
(
   [report_suites] => Array
       (
           [0] => Array
               (
                   [rsid] => your.rsid
                   [site_title] => Your Site
               )
           ...
       )
)

```

### Endpoints

[](#endpoints)

The default endpoint is **api.omniture.com**. If you are experiencing issues, call the `Company.GetEndpoint` method to find out which endpoint you should be using:

```
$ ./bin/adm Company.GetEndpoint 'company=My Company'
https://api2.omniture.com/admin/1.3/rest/

```

In this case, the endpoint is *api2.omniture.com*. To use this endpoint instead, set the endpoint in your profile:

```
$ ./bin/amc profile endpoint api2.omniture.com
default value for "endpoint" set to api2.omniture.com

```

Now all subsequent requests will use this endpoint. If you need to use an endpoint other than the default, you can pass this in with the `-e` or `--endpoint` options

```
$ ./bin/amc authorize CLIENT_ID CLIENT_SECRET USERNAME PASSWORD --endpoint 'api3.omniture.com'

```

To Do
-----

[](#to-do)

Better documentation and test coverage will be coming soon

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity48

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 78.8% of commits — single point of failure

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 ~234 days

Recently: every ~258 days

Total

7

Last Release

2974d ago

Major Versions

1.0.0 → 2.0.22015-03-20

PHP version history (2 changes)1.0.0PHP &gt;=5.2.4

2.0.2PHP &gt;=5.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/a8713415b20b4be4cec8f8b22741e3cd05f76eee9e38de1de5bf32727349b7c5?d=identicon)[bshaffer](/maintainers/bshaffer)

![](https://www.gravatar.com/avatar/8bf345071f76d882894af6efe175ec8ddfafbae1521e50ea133135a8c5727ae1?d=identicon)[garyr](/maintainers/garyr)

---

Top Contributors

[![bshaffer](https://avatars.githubusercontent.com/u/103941?v=4)](https://github.com/bshaffer "bshaffer (93 commits)")[![garyr](https://avatars.githubusercontent.com/u/449938?v=4)](https://github.com/garyr "garyr (21 commits)")[![jarestev](https://avatars.githubusercontent.com/u/152909905?v=4)](https://github.com/jarestev "jarestev (1 commits)")[![kkopachev](https://avatars.githubusercontent.com/u/2279051?v=4)](https://github.com/kkopachev "kkopachev (1 commits)")[![mledwards](https://avatars.githubusercontent.com/u/2692615?v=4)](https://github.com/mledwards "mledwards (1 commits)")[![stevja1](https://avatars.githubusercontent.com/u/6765406?v=4)](https://github.com/stevja1 "stevja1 (1 commits)")

---

Tags

cloudmarketingsuitemarketing cloudadobeomnituredigitaldigital marketing suite

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/adobe-marketing-cloud-marketing-cloud-php-sdk/health.svg)

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

###  Alternatives

[alibabacloud/client

Alibaba Cloud Client for PHP - Use Alibaba Cloud in your PHP project

2223.5M367](/packages/alibabacloud-client)[jordikroon/google-vision

Google Vision Api for PHP (https://cloud.google.com/vision/)

6374.9k1](/packages/jordikroon-google-vision)[opencoconut/coconut

Coconut is a Cloud Video Encoding Service built for developers

17482.5k2](/packages/opencoconut-coconut)[rustici-software/scormcloud-api-v2-client-php

20253.2k](/packages/rustici-software-scormcloud-api-v2-client-php)[currency-cloud/client

A PHP library which implements the complete functionality of v2 of the The Currency Cloud API.

17327.2k](/packages/currency-cloud-client)[platforg/adobe-connect

Provides a PHP Client to interact with the Adobe Connect's API

1510.1k2](/packages/platforg-adobe-connect)

PHPackages © 2026

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