Download the PHP package amazon-php/sp-api-sdk without Composer
On this page you can find all versions of the php package amazon-php/sp-api-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download amazon-php/sp-api-sdk
More information about amazon-php/sp-api-sdk
Files in amazon-php/sp-api-sdk
Package sp-api-sdk
Short Description Amazon Selling Partner API - PHP SDK
License MIT
Homepage https://openapi-generator.tech
Informations about the package sp-api-sdk
Amazon Selling Partner API - PHP SDK
This repository is not an official Amazon PHP library for their SP API.
We Stand Against Terror
Stand With Ukraine | Stand With Us |
On Feb. 24, 2022, Russia declared an unprovoked war on Ukraine and launched a full-scale invasion. Russia is currently bombing peaceful Ukrainian cities, including schools and hospitals and attacking civilians who are fleeing conflict zones.
On Oct. 7, 2023, the national holiday of Simchat Torah, Hamas terrorists initiated an attack on Israel in the early hours, targeting civilians. They unleashed violence that resulted in at least 1,400 casualties and abducted at least 200 individuals, not limited to Israelis.
Why next library?
The main goal of this SDK is to provide SDK's for the Amazon SP API in a way that would let the application to pass Amazon audit.
Amazon audit might happen to systems that must access API endpoints with PII.
There are already few php sp api SDKs available for PHP however most of them comes with many issues of auto generated code.
- hardcoded dependencies like
guzzlehttp/guzzle
oraws/aws-sdk-php
- legacy code base (7.2)
- no logger
- SDK's are oriented around single seller which is not suitable for bigger systems
- missing or lacking support for
client_credentials
grant type - not all API covered
- no extensions
This library goal is to resolve all above mentioned issues.
Installations
This library is not in a stable stage yet, please use with caution.
Releases
branch | maintained |
---|---|
1.x | 🚫 |
2.x | 🚫 |
3.x | 🚫 |
4.x | 🚫 |
5.x | 🚫 |
6.x | ✅ |
7.x | ✅ |
Version 1.x is deprecated becuase of the attempt to
make a little more sense of what Amazon is doing with using "tags" in their Open API specification.
This attempt failed and in order to keep Backward Compatibility promise, changes in the class names had to be
introduced in 2.x.
Version 1.0 is not going to be updated anymore, please migrate to version 2.0 that will stay consistent with Amazon Models
Branch 3.x comes with BC breaks introduced by Amazon in
Catalog Item models.
Until old model won't go away, branches 2.x and 3.x should be maintained in parallel.
4.x comes with BC breaks in following Amazon api models:
- Listings
- Reports
- Vendor
- Direct Fulfillment Shipping
- Direct Fulfillment Orders
- Direct Fulfillment Transactions
5.x moves to Catalog Item API version 2022-04-01 which is replacing version 2020-12-01. Additionally, uuid used to generate correlation identifiers was replaced with IdGenerator interface that by default is using php internal uniqid(). This change allowed us to drop one additional dependency. Some minor adjustments were made in the template files for models/api.
6.x comes with changes to the Fulfillment Inbound API as well as other additions and removals.
- Additions
- Fulfillment Inbound API v2024-03-20
- This is a major change. The version takes the place of the version in namespace whereas the version SDK is now and the models are within the directory.
- Amazon Warehousing and Distribution API v2024-05-09
- Application Management API v2023-11-30
- Removals
- Authorization API
- FBA Small and Light API
- You can retrieve the new fees for affected products by using the Product Fees API and/or the relevant FBA and Referral Fee reports.
Available SDKs
SellingPartnerSDK - Facade for all SDK's
- APlusSDK
- ApplicationManagement
- CatalogItemSDK
- FBAInboundSDK
- FBAInventorySDK
- FulfillmentInboundV0SDK
- FulfillmentInboundSDK
- FeedsSDK
- FinancesSDK
- FulfillmentOutboundSDK
- ListingsItemsSDK
- MessagingSDK
- NotificationsSDK
- OrdersSDK
- Shipment/OrdersSDK
- ProductFeesSDK
- ProductPricingSDK
- ProductTypesDefinitionsSDK
- ReportsSDK
- SalesSDK
- SellersSDK
- ServicesSDK
- ShipmentInvoicingSDK
- ShippingSDK
- SolicitationsSDK
- TokensSDK
- UploadsSDK
- WarehousingAndDistributionSDK
- VendorSDK
- VendorInvoicesSDK
- VendorOrdersSDK
- VendorShipmentsSDK
- VendorTransactionStatusSDK
- VendorDirectFulfillmentInventorySDK
- VendorDirectFulfillmentTransactionsSDK
- VendorDirectFulfillmentShippingSDK
- VendorDirectFulfillmentOrdersSDK
- VendorDirectFulfillmentPaymentsSDK
Authorization
In order to start using SP API you need to first register as a Developer and create application. Whole process is described in Amazon Official Guides.
Amazon recommends to use Role IAM when creating application however this requires and additional API request in order to obtain access token. It's easier to use User IAM and just make sure that the user has following Inline Policy
IAM User
Example of changing refresh token into access token.
IAM Role
Development
99% of code in this library is auto generated from Amazon Selling Partner API Models using OpenAPI Generator tool. Output is later automatically upgraded by RectorPHP to PHP 7.4 version and finally coding standards are also automatically unified by PHP CS Fixer.
Requirements:
In oder to regenerate code (for example when API definitions change), execute following code:
Examples
Logging
Default log level is set up to DEBUG, but it can be changed in configuration to any other level for all operations in all APIs or only for given operation in given API.
Specific API's or only given operations can be also excluded from logging (for example APIs with PII or sensitive data).
Finally, you can also ignore specific headers when logging http request/response. By default, configuration is set to ignore following sensitive authorization headers:
you can also add your own ignored headers:
Extensions
Each SDK allows you to register custom extensions executed before and after sending API requests.
Sandbox
Sandbox mode can be turned on using configuration:
Some APIs endpoints are covered in functional tests.
To run tests that are using sandbox mode, you need to create .env
file and populate it with your credentials:
Then you can enter composer test:functional
te execute sandbox test suite.
All versions of sp-api-sdk with dependencies
ext-curl Version *
ext-json Version *
ext-mbstring Version *
psr/http-client Version ^1.0.1
psr/http-factory Version ^1.0
psr/log Version ^1.1||^2.0||^3.0