PHPackages                             caponica/amazon-mws-complete - 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. caponica/amazon-mws-complete

ActiveLibrary[API Development](/categories/api)

caponica/amazon-mws-complete
============================

Complete Amazon MWS PHP SDK, including all libraries

v0.1(10y ago)5635.9k51[3 issues](https://github.com/caponica/AmazonMwsComplete/issues)1Apache-2.0PHPPHP &gt;=5.3.2

Since Apr 13Pushed 5y ago8 watchersCompare

[ Source](https://github.com/caponica/AmazonMwsComplete)[ Packagist](https://packagist.org/packages/caponica/amazon-mws-complete)[ RSS](/packages/caponica-amazon-mws-complete/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (1)

Complete Amazon MWS API
=======================

[](#complete-amazon-mws-api)

This is an attempt to simplify access to the full range of MWS API calls from a single package.

Installation
============

[](#installation)

Into a Symfony project
----------------------

[](#into-a-symfony-project)

Add the reference into your composer.json :

```
"caponica/amazon-mws-complete": "dev-master"

```

Use in controller :

```
 $client = new \MwsProductClient(/* args */);

```

Accessing the API
=================

[](#accessing-the-api)

You can access each API directly if you want to:

```
use CaponicaAmazonMwsComplete\AmazonClient\MwsProductClient;

$mwsProductClientUsa = new MwsProductClient(
    'YOUR_ACCESS_KEY',
    'YOUR_SECRET_KEY',
    'YOUR_APP_NAME',
    'YOUR_APP_VERSION',
    [ 'ServiceURL' => 'https://mws.amazonservices.com/Products/2011-10-01' ]
);

$mwsResponse = $mwsProductClientUsa->getCompetitivePricingForASIN([
    'SellerId'          => 'YOUR_SELLER_ID',
    'MarketplaceId'     => 'MARKETPLACE_ID',
    'ASINList'          => array('ASIN' => 'YOUR_ASIN_SEARCH'),
]);
// ... do something with the response ...

```

However, there is a better way! The MwsClientPool encapsulates all configuration shared between all different Amazon API services. So create that once (for each marketplace/seller combination you want to work with) and then retrieve 'ClientPacks' from the pool. A ClientPack includes configuration for a single Seller and Marketplace and these can be pre-filled into API calls by using the callXyz() methods (e.g. callGetCompetitivePricingForASIN() to call the API's getCompetitivePricingForASIN() method. This makes your API calls much cleaner:

```
use CaponicaAmazonMwsComplete\ClientPool\MwsClientPool;
use CaponicaAmazonMwsComplete\ClientPool\MwsClientPoolConfig;

$mwsClientPoolUsa = new MwsClientPool();
$mwsClientPoolUsa->setConfig([
    'amazon_site'           => MwsClientPoolConfig::SITE_US
    'access_key'            => 'YOUR_ACCESS_KEY'
    'secret_key'            => 'YOUR_SECRET_KEY'
    'application_name'      => 'YOUR_APP_NAME'
    'application_version'   => 'YOUR_APP_VERSION'
    'seller_id'             => 'YOUR_SELLER_ID'
]);

$productClientPackUsa = $mwsClientPoolUsa->getProductClientPack();
$mwsResponse = $productClientPackUsa->callGetCompetitivePricingForASIN('YOUR_ASIN_SEARCH');

```

There are also some helper methods that return objects (or arrays of objects) that are easier to work with than raw MWS responses:

```
/** @var MwsCompetitivePricing[] $compPricings */
$compPricings = $productClientPackUsa->retrieveCompetitivePricingForASIN('YOUR_ASIN_SEARCH');
foreach ($compPricings as $compPricing) {
    echo $compPricing->asin;
}

```

MWSAuthToken
============

[](#mwsauthtoken)

If you're using an MWSAuthToken then you can pass it in via the config:

```
$mwsClientPoolUsa->setConfig([
    'auth_token'            => 'YOUR_MWS_AUTH_TOKEN',
    // ... other parameters ...
]);

```

Once set on the ClientPool, the token should be passed through to each Client and used in every API request.

*REQUEST: Please feed back via [github](https://github.com/caponica/AmazonMwsComplete/issues) if this is the best way to set and use the MWSAuthToken, and if it all works as expected. I don't used this functionality myself so cannot test it properly.*

Logging
=======

[](#logging)

The scripts no longer echo messages. Instead they use a Logger which you can define when you instantiate the ClientPool.

See  and for more details about setting up a Logger.

A basic Logger (which replicates the old echo behaviour), would look like this:

```
# EchoLogger.php

namespace Your\Path;

use Psr\Log\AbstractLogger;

class EchoLogger extends AbstractLogger
{
    /**
     * Logs with an arbitrary level.
     *
     * @param mixed  $level
     * @param string $message
     * @param array  $context
     *
     * @return void
     */
    public function log($level, $message, array $context = array())
    {
        echo "$message\n";
    }
}

```

You then simply pass an EchoLogger instance into the MwsClientPool constructor:

```
use CaponicaAmazonMwsComplete\ClientPool\MwsClientPool;
use Your\Path\EchoLogger;

$echoLogger = new EchoLogger();
$mwsClientPoolUsa = new MwsClientPool($echoLogger);

```

Working with reports
====================

[](#working-with-reports)

There are domain objects to help with reading reports. Not all reports have been implemented (by a long way!) but feel free to implement any that you need to use and submit a PR. The basic structure is to have a `ReportXyz` class related to the overall report and a `ReportXyzRecord` class relating to each record (row) in the report.

The basic usage would then look something like:

```
$reportFilePath = '/path/to/file.txt';
$reportType = MwsFeedAndReportClientPack::REPORT_FBA_INVENTORY_AFN;
$fileHandle = @fopen($reportFilePath, 'r');
if (!$fileHandle) {
    return "Could not open $reportFilePath to read the report from";
}

try {
    while (($lineFromFile = fgets($fileHandle)) !== false) {
        if (!$checkedHeader) {
            BaseMwsReport::validateHeaderRowForReportType($lineFromFile, $reportType);
            $reportRecordClass = BaseMwsReport::convertReportTypeToReportRecordClass($reportType);
            $checkedHeader = true;
            continue;
        }

        $reportRecord = new $reportRecordClass($lineFromFile);
        // do something with the record
        echo "The SellerSku field value is" . $reportRecord->getSellerSku();
    }
} catch (InvalidReportHeaderException $e) {
    // Handle the exception, which is thrown if the header is not the expected format
} catch (InvalidReportRecordException $e) {
    // Handle the exception, which is thrown if the row is not the expected format
}

```

Client library versions
=======================

[](#client-library-versions)

LibraryAPI versionLibrary versionFBAInboundServiceMWS2010-10-012016-10-05FBAInventoryServiceMWS2010-10-012014-09-30FBAOutboundServiceMWS2010-10-012016-01-01 \*1MarketplaceWebService2009-01-012016-09-21MarketplaceWebServiceOrders2013-09-012020-05-11MarketplaceWebServiceProducts2011-10-012017-03-22MarketplaceWebServiceSellers2011-07-012015-06-18MWSCartService2014-03-012015-06-18 ??MWSCustomerService2014-03-012015-06-18 ??MWSFinancesService2015-05-012020-02-21MWSMerchantFulfillmentService2015-06-012020-02-06MWSRecommendationsSectionService2013-04-012014-10-01 \*1MWSSubscriptionsService2013-07-012013-11-01 \*1?? Amazon has deprecated these APIs, so they may be removed from this package in future.

\*1 These libraries used to show later Library versions (dates) but this is what they say in the current Client.php files

The [Off-Amazon Payments API](https://developer.amazonservices.co.uk/doc/offamazonpayments/offamazonpayments/v20130101/php.html)is not currently included, since it is not directly linked to MWS activity. [Off-Amazon Payments Technical Reference](https://payments.amazon.co.uk/developer/documentation)

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.5% 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

Unknown

Total

1

Last Release

3680d ago

### Community

Maintainers

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

---

Top Contributors

[![caponica](https://avatars.githubusercontent.com/u/203801?v=4)](https://github.com/caponica "caponica (132 commits)")[![jasonhebert](https://avatars.githubusercontent.com/u/4276690?v=4)](https://github.com/jasonhebert "jasonhebert (18 commits)")[![colinmollenhour](https://avatars.githubusercontent.com/u/38738?v=4)](https://github.com/colinmollenhour "colinmollenhour (2 commits)")[![josh8k](https://avatars.githubusercontent.com/u/5819788?v=4)](https://github.com/josh8k "josh8k (2 commits)")[![codebymikey](https://avatars.githubusercontent.com/u/9484406?v=4)](https://github.com/codebymikey "codebymikey (1 commits)")[![cw-24](https://avatars.githubusercontent.com/u/58806156?v=4)](https://github.com/cw-24 "cw-24 (1 commits)")[![iozkn](https://avatars.githubusercontent.com/u/6625546?v=4)](https://github.com/iozkn "iozkn (1 commits)")[![AdrianAdamiec](https://avatars.githubusercontent.com/u/3783972?v=4)](https://github.com/AdrianAdamiec "AdrianAdamiec (1 commits)")[![kelkholy](https://avatars.githubusercontent.com/u/18029445?v=4)](https://github.com/kelkholy "kelkholy (1 commits)")[![anhvn](https://avatars.githubusercontent.com/u/4526322?v=4)](https://github.com/anhvn "anhvn (1 commits)")[![billhance](https://avatars.githubusercontent.com/u/476902?v=4)](https://github.com/billhance "billhance (1 commits)")[![bretto36](https://avatars.githubusercontent.com/u/6217994?v=4)](https://github.com/bretto36 "bretto36 (1 commits)")

---

Tags

amazonmws

### Embed Badge

![Health badge](/badges/caponica-amazon-mws-complete/health.svg)

```
[![Health](https://phpackages.com/badges/caponica-amazon-mws-complete/health.svg)](https://phpackages.com/packages/caponica-amazon-mws-complete)
```

###  Alternatives

[looxis/laravel-amazon-mws

Simple Amazon MWS API Package for Laravel

3218.7k](/packages/looxis-laravel-amazon-mws)[sonnenglas/laravel-amazon-mws

Use Amazon's MWS web services with Laravel ^7.x. Based on creacoon/amazon-mws-laravel package and modified to make it compatible with latest Laravel releases (+ bugfixes).

644.5k](/packages/sonnenglas-laravel-amazon-mws)[tilleuls/amazon-mws-orders

Amazon Marketplace Web Service Orders PHP Client Library

1288.1k1](/packages/tilleuls-amazon-mws-orders)[thiagomarini/amazon-mws-client

PHP client for Amazon MWS API

151.4k](/packages/thiagomarini-amazon-mws-client)

PHPackages © 2026

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