PHPackages                             zero-to-prod/spapi-lwa - 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. zero-to-prod/spapi-lwa

ActiveLibrary[API Development](/categories/api)

zero-to-prod/spapi-lwa
======================

Connect to Amazons Selling Partner API with Login With Amazon (LWA).

v4.1.0(1y ago)21.8k[2 issues](https://github.com/zero-to-prod/spapi-lwa/issues)[2 PRs](https://github.com/zero-to-prod/spapi-lwa/pulls)5MITPHPPHP &gt;=7.1

Since Feb 2Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/zero-to-prod/spapi-lwa)[ Packagist](https://packagist.org/packages/zero-to-prod/spapi-lwa)[ Docs](https://github.com/zero-to-prod/spapi-lwa)[ Fund](https://github.com/sponsors/zero-to-prod)[ RSS](/packages/zero-to-prod-spapi-lwa/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (5)Versions (24)Used By (5)

Zerotoprod\\SpapiLwa
====================

[](#zerotoprodspapilwa)

[![](art/logo.png)](art/logo.png)

[![Repo](https://camo.githubusercontent.com/9a90a3efeee26aed7d7f2feee9cd84566a26f9c362cc773b184d076210906e1c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6769746875622d677261793f6c6f676f3d676974687562)](https://github.com/zero-to-prod/spapi-lwa)[![GitHub Actions Workflow Status](https://camo.githubusercontent.com/1b19926c224ada2be4baa29b270af3d842a69f3ff35f9f05d7396649a294e60c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7a65726f2d746f2d70726f642f73706170692d6c77612f746573742e796d6c3f6c6162656c3d74657374)](https://github.com/zero-to-prod/spapi-lwa/actions)[![GitHub Actions Workflow Status](https://camo.githubusercontent.com/ae7bc92567aa1996a1707fcaca6ff62a535433f2ea8dc405a79722886ab77530/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7a65726f2d746f2d70726f642f73706170692d6c77612f6261636b77617264735f636f6d7061746962696c6974792e796d6c3f6c6162656c3d6261636b77617264735f636f6d7061746962696c697479)](https://github.com/zero-to-prod/spapi-lwa/actions)[![Packagist Downloads](https://camo.githubusercontent.com/781d77c74e0208da222c5816a9af153c3fc1041822b4ccd1821b79ef645d714c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a65726f2d746f2d70726f642f73706170692d6c77613f636f6c6f723d626c7565)](https://packagist.org/packages/zero-to-prod/spapi-lwa/stats)[![php](https://camo.githubusercontent.com/40327632bb0972c8ea42396b8f757339ade9c354bcccd6be40cd403ee76a904b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7a65726f2d746f2d70726f642f73706170692d6c77612e7376673f636f6c6f723d707572706c65)](https://packagist.org/packages/zero-to-prod/spapi-lwa/stats)[![Packagist Version](https://camo.githubusercontent.com/d634e1c28e847f4d2229ed3f389f77cf9abce2141a5e00cb2481d46decb37643/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a65726f2d746f2d70726f642f73706170692d6c77613f636f6c6f723d663238643161)](https://packagist.org/packages/zero-to-prod/spapi-lwa)[![License](https://camo.githubusercontent.com/d6936ccb12949f6b163bbdc05c492048bffa87ab2a336a373fc70dd36cd78715/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7a65726f2d746f2d70726f642f73706170692d6c77613f636f6c6f723d70696e6b)](https://github.com/zero-to-prod/spapi-lwa/blob/main/LICENSE.md)[![wakatime](https://camo.githubusercontent.com/ce9f29b1faa784d224d77f790029929d6acf26bbadc7f8632e78efe3ddcb121e/68747470733a2f2f77616b6174696d652e636f6d2f62616467652f6769746875622f7a65726f2d746f2d70726f642f73706170692d6c77612e737667)](https://wakatime.com/badge/github/zero-to-prod/spapi-lwa)[![Hits-of-Code](https://camo.githubusercontent.com/902192feec0c387db37f5178291ed4b9c8871f0c2718c3650d4bf02fd99623ad/68747470733a2f2f686974736f66636f64652e636f6d2f6769746875622f7a65726f2d746f2d70726f642f73706170692d6c77613f6272616e63683d6d61696e)](https://hitsofcode.com/github/zero-to-prod/spapi-lwa/view?branch=main)

Contents
--------

[](#contents)

- [Introduction](#introduction)
- [Requirements](#requirements)
- [Installation](#installation)
- [Documentation Publishing](#documentation-publishing)
    - [Automatic Documentation Publishing](#automatic-documentation-publishing)
- [Usage](#usage)
    - [Access Toke from Refresh Token](#access-toke-from-refresh-token)
    - [Access Toke from Scope](#access-token-from-scope)
- [Testing](#testing)
- [Local Development](./LOCAL_DEVELOPMENT.md)
- [Contributing](#contributing)

Introduction
------------

[](#introduction)

Connect to Amazons Selling Partner API with [Login With Amazon](https://developer-docs.amazon.com/sp-api/docs/connecting-to-the-selling-partner-api) ( LWA).

Requirements
------------

[](#requirements)

- PHP 7.1 or higher.

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

[](#installation)

Install `Zerotoprod\SpapiLwa` via [Composer](https://getcomposer.org/):

```
composer require zero-to-prod/spapi-lwa
```

This will add the package to your project's dependencies and create an autoloader entry for it.

Documentation Publishing
------------------------

[](#documentation-publishing)

You can publish this README to your local documentation directory.

This can be useful for providing documentation for AI agents.

This can be done using the included script:

```
# Publish to default location (./docs/zero-to-prod/spapi-lwa)
vendor/bin/zero-to-prod-spapi-lwa

# Publish to custom directory
vendor/bin/zero-to-prod-spapi-lwa /path/to/your/docs
```

### Automatic Documentation Publishing

[](#automatic-documentation-publishing)

You can automatically publish documentation by adding the following to your `composer.json`:

```
{
    "scripts": {
        "post-install-cmd": [
            "zero-to-prod-spapi-lwa"
        ],
        "post-update-cmd": [
            "zero-to-prod-spapi-lwa"
        ]
    }
}
```

Usage
-----

[](#usage)

### Access Toke from Refresh Token

[](#access-toke-from-refresh-token)

Use this for calling operations that require authorization from a selling partner. All operations that are not grantless operations require authorization from a selling partner. When specifying this value, include the rrefresh\_token parameter.

```
use Zerotoprod\SpapiLwa\SpapiLwa;

$response = SpapiLwa::from('client_id','client_secret')
    ->refreshToken('refresh_token');

$access_token = $response['response']['access_token'];
```

### Access Token from Scope

[](#access-token-from-scope)

Use this for calling grantless operations. When specifying this value, include the scope parameter.

```
use Zerotoprod\SpapiLwa\SpapiLwa;

$response = SpapiLwa::from('client_id','client_secret')
    ->clientCredentials('scope');

$access_token = $response['response']['access_token'];
```

Testing
-------

[](#testing)

You can test the api by faking the response:

```
use Zerotoprod\SpapiLwa\SpapiLwa;
use Zerotoprod\SpapiLwa\Support\Testing\SpapiLwaResponseFactory;

$response = SpapiLwaResponseFactory::factory()
    ->asRefreshTokenResponse()
    ->make()

SpapiLwaFake::fake($response);

SpapiLwa::from('client_id', 'client_secret')
```

Contributing
------------

[](#contributing)

Contributions, issues, and feature requests are welcome! Feel free to check the [issues](https://github.com/zero-to-prod/spapi-lwa/issues) page if you want to contribute.

1. Fork the repository.
2. Create a new branch (`git checkout -b feature-branch`).
3. Commit changes (`git commit -m 'Add some feature'`).
4. Push to the branch (`git push origin feature-branch`).
5. Create a new Pull Request.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance46

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

20

Last Release

518d ago

Major Versions

v1.0.9 → v2.0.02025-02-02

v2.0.0 → v3.0.142025-02-02

v3.0.16 → v4.0.02025-02-02

### Community

Maintainers

![](https://www.gravatar.com/avatar/502649f05d36c87d494988bd99193a4d908d345335d99c080928a726277371f5?d=identicon)[zero-to-prod](/maintainers/zero-to-prod)

---

Top Contributors

[![zero-to-prod](https://avatars.githubusercontent.com/u/61474950?v=4)](https://github.com/zero-to-prod "zero-to-prod (32 commits)")

---

Tags

zero-to-prodspapi-lwa

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zero-to-prod-spapi-lwa/health.svg)

```
[![Health](https://phpackages.com/badges/zero-to-prod-spapi-lwa/health.svg)](https://phpackages.com/packages/zero-to-prod-spapi-lwa)
```

###  Alternatives

[zero-to-prod/data-model

Transforms Data into Type-Safe DTOs.

14231.6k32](/packages/zero-to-prod-data-model)

PHPackages © 2026

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