Download the PHP package highsidelabs/amazon-business-api without Composer

On this page you can find all versions of the php package highsidelabs/amazon-business-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package amazon-business-api

Total downloads Latest stable version License

Amazon Business API for PHP

A PHP library for connecting to Amazon's Business API.

Related packages


This package is developed and maintained by Highside Labs. If you need support integrating with Amazon's (or any other e-commerce platform's) APIs, we're happy to help! Shoot us an email at [email protected]. We'd love to hear from you :)

If you've found any of our packages useful, please consider becoming a Sponsor, or making a donation via the button below. We appreciate any and all support you can provide!

Donate to Highside Labs


(There is a more in-depth guide to using this package on our blog, here.)

Features

Installation

composer require highsidelabs/amazon-business-api

Table of Contents

Check out the Getting Started section below for a quick overview.

This README is divided into several sections:

Getting Started

We wrote a blog post with more detailed instructions on connecting to the Amazon Business API here. Check it out if you need more help getting set up.

Prerequisites

You need a few things to get started:

If you're looking for more information on how to set those things up, check out this blog post. It provides a detailed walkthrough of the whole setup process. That guide refers to the Selling Partner API, but all the setup steps are the same for the Amazon Business API.

Setup

The Configuration constructor takes a single argument: an associative array with all the configuration information that's needed to connect to the Amazon Business API:

If you created your Amazon Business API application using an IAM role ARN instead of a user ARN, pass that role ARN in the configuration array:

Getter and setter methods exist for the Configuration class's lwaClientId, lwaClientSecret, lwaRefreshToken, awsAccessKeyId, awsSecretAccessKey, and endpoint properties. The methods are named in accordance with the name of the property they interact with: getLwaClientId, setLwaClientId, getLwaClientSecret, etc.

$config can then be passed into the constructor of any AmazonBusinessApi\Api\*Api class. See the Example section for a complete example.

Configuration options

The array passed to the Configuration constructor accepts the following keys:

Examples

This example assumes you have access to the Product Search Amazon Business API role, but the general format applies to any Amazon Business API request.

Debug mode

To get debugging output when you make an API request, you can call $config->setDebug(true). By default, debug output goes to stdout via php://output, but you can redirect it a file with $config->setDebugFile('<path>').

Supported API segments

Each API class name contains the API's version. This allows for multiple versions of the same API to be accessible in a single version of this package. It makes the class names a little uglier, but allows for simultaneously using new and old versions of the same API segment, which is often useful. The uglier names can be remedied by formatting use statements like so:

It also means that if a new version of an existing API is introduced, the library can be updated to include that new version without introducing breaking changes.

Working with model classes

Most operations have one or more models associated with it. These models are classes that contain the data needed to make a certain kind of request to the API, or contain the data returned by a given request type. All of the models share the same general interface: you can either specify all the model's attributes during initialization, or set each attribute after the fact. Here's an example using the User Management API's AccountHolder model (docs), (source).

The AccountHolder model has three attributes: email, given_name, and family_name. (If you're wondering how to figure out which attributes a model has on your own, check out the docs link above.) To create an instance of the AccountHolder model with all those attributes set:

Alternatively, you can create an instance of the Buyer model and then populate its fields:

Each model also has the property accessors you might expect:

Models can (and usually do) have other models as attributes:

If a model attribute is supposed to be an array, its type signature will be something like ModelClass[] (note the trailing []). For instance, the OrderingV1Api's placeOrder method takes a model named PlaceOrderRequest with an attribute called line_items. The type for line_items is RequestLineItem[], and the attribute should be set like so:

Response headers

Amazon includes some useful headers with each SP API response. If you need those for any reason, you can get an associative array of response headers by calling getHeaders() on the response object. For instance:

Custom Authorization Signer

You may need to do custom operations while signing the API request. You can create a custom authorization signer by creating an implementation of the AuthorizationSignerContract interface and passing it into the Configuration constructor array.

Custom Request Signer

You may also need to customize the entire request signing process – for instance, if you need to call an external service in the process of signing the request. You can do so by creating an implementation of the RequestSignerContract interface, and passing an instance of it into the Configuration constructor array.


All versions of amazon-business-api with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
ext-curl Version *
ext-json Version *
ext-mbstring Version *
guzzlehttp/guzzle Version ^6.0|^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package highsidelabs/amazon-business-api contains the following files

Loading the files please wait ....