Download the PHP package kbart/amazon-ads-sdk without Composer

On this page you can find all versions of the php package kbart/amazon-ads-sdk. 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-ads-sdk

Laravel Amazon Ads SDK

Run Tests

A developer-friendly (DX) Laravel package for integrating the Amazon Ads API.

This package combines the type safety of a generated OpenAPI SDK with the convenience of dynamic Laravel proxy routes. It handles the complete authentication (LWA Token Refresh), rate limiting, and DTO hydration for you.

💎 Features


⚡ Installation

  1. Install the package via Composer

  2. Publish the configuration file

  3. Add your default credentials to your .env file

  4. Routes & Middleware

By default, the package registers the SDK routes under the prefix api/amazon-ads/sdk/{seller}. To use the SDK routes, you must manually load them in your routes/api.php. You can also assign your own middleware:

(If you register the routes in your web.php, you must either include the 'api' middleware or exclude the routes from the CSRF token check in your bootstrap/app.php!)


Usage

1. The SdkProxy (Recommended)

The SdkProxyController receives HTTP requests, forwards them to the corresponding classes of the generated SDK, and returns the result as clean JSON.

Example Request (POST): Request to your local Laravel endpoint to fetch keywords.

(The AmazonAdsExecutor recognizes that the sponsoredProductsListSponsoredProductsKeywordsRequestContent parameter requires a complex SDK object and safely casts your JSON array into this DTO before calling the SDK method.)

A. Docs / Info Route (Self-Documenting API)

Want to know which APIs are available and what the payload should look like? Send a GET request to the info routes:

The response will show you exactly which parameters are expected, whether a complex DTO needs to be sent, and which Enum values are allowed!

2. The Native Proxy

If you want to bypass the SDK completely and instead call the Amazon endpoints directly using Guzzle/Laravel HTTP, use the ProxyController.

Example Request (POST):

3. Direct Usage in PHP (Facades)

If you are building complex calculations or nightly synchronizations, you should use the generated SDK classes directly. You can comfortably use the AmazonAdsFactory facade for this. The package handles token injection and rate-limit retries in the background!


👨‍💼 Advanced

1. Custom Credentials Resolver

By default, the package uses the .env variables. If you want to store your seller data in a database, for example, you can define your own credentials resolver in the AppServiceProvider of your Laravel application.

From now on, the package will always call this logic when executing API calls!

2. Set a custom user-agent

Amazon does not strictly require a specific User-Agent; it can be determined by you and adjusted in the config if necessary.

3. Caching & TTL Configuration

In config/amazon-ads.php, specific TTL values for caching endpoints can be defined.


Enable Debugging

If you want to enable debugging for the SDK, adjust the corresponding parameters in the config.


🛠️ SDK Generation (Build Process)

This SDK uses the official OpenAPI Specifications from Amazon to always remain 100% type-safe and up to date. The required .json and .yaml specification files are now located directly within your package in the ./resources/openapi/ directory. An automated pipeline based on Node.js and PHP has been built, generating ready-to-use classes for you at the push of a button. This utilizes the official openapi-generator-cli tool. The build script also automatically fixes known Amazon OpenAPI bugs and cleans up the endpoints.

Prerequisites

Ensure that you have Node.js and npm installed on your system. Before running for the first time, install the necessary dependencies in the root directory of the package:

1. Regenerate all endpoints

If you want to bring the entire SDK up to date, run this command:

(This is equivalent to npm run clean && npm run generate)

What happens in the background?

  1. The src/Generated folder is completely emptied.
  2. The script loads the OpenAPI files directly from the local ./resources/openapi/ directory.
  3. A pre-processor script cleans the OpenAPI spec files in .json format and removes problematic Content-Types like application/json if application/vnd... is present.
  4. The openapi-generator-cli generates all Models (DTOs) and APIs.
  5. All redundant boilerplate files are cleaned up (cleanup.js). (Uses rimraf under the hood).
  6. A PHP script (generate_api_map.php) scans the new classes and fully automatically creates the src/Laravel/amazon_api_map.php file, which acts as a lightning-fast registry.
  7. A post-processor script fixes duck-typing and import issues in the generated classes ObjectSerializer.php and FormDataProcessor.php.

2. Update a single endpoint

If Amazon has only updated one area (e.g., SponsoredProduct), you can specifically target individual endpoints without rebuilding everything:

(This only updates the SponsoredProduct classes and automatically regenerates the API map at the end, without deleting other endpoints).

3. Add a new endpoint

Has Amazon released a new API? No problem:

  1. Download the specification file from Amazon and save it in your ./resources/openapi/ folder (e.g., as NewApi.json).
  2. Open the generate-apis.js file in the root directory.
  3. Add a new entry to the apis array, referencing the local file path: { name: 'GreatNewApi', input: './resources/openapi/NewApi.json' }
  4. Run npm run generate -- GreatNewApi.
  5. Done! The API is now immediately available as a PHP class and is automatically registered in the Proxy Controller.

📄 License

This project is licensed under the Apache License 2.0.


All versions of amazon-ads-sdk with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
guzzlehttp/guzzle Version ^7.0
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/cache Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0
illuminate/routing Version ^10.0|^11.0|^12.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 kbart/amazon-ads-sdk contains the following files

Loading the files please wait ...