承接 jakiboy/apaapi 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jakiboy/apaapi

Composer 安装命令:

composer require jakiboy/apaapi

包简介

Easily integrate with the Amazon Affiliate Program using the lightweight APAAPI library for Amazon Creators API (With OAuth 2.0 & Credential-less)

README 文档

README

Amazon Creators API PHP

-- Amazon Affiliate With PHP --

Apaapi is an unofficial PHP library for accessing the Amazon Creators API, without relying on the Amazon SDK. It is lightweight (~300 KB) and simplifies interaction with the Amazon Creators API, making it easier to integrate Amazon product data into PHP applications.

Caution

Apaapi 2.x exclusively uses the Amazon Creators API.
Support for Apaapi 1.x (PA-API v5) has been discontinued!

💡 Features

  • Request Builder (Easier way to fetch API data).
  • OAuth 2.0: Implements OAuth 2.0 authentication.
  • Credential-less (No credentials required using product scraper).
  • Dual HTTP Support (Auto-detects cURL or Stream fallback for maximum compatibility).
  • Search Filters (Using builder).
  • Geotargeting (Automatically redirect links based on the visitor's region).
  • Cart Generator (Add to cart URL).
  • Rating (Customer reviews).
  • Response Normalizer (Normalize response data structure).
  • Response Error Handling (Including semantic errors with HTTP status code 200).
  • Keyword Converter (ASIN, ISBN, EAN, Node, Root).
  • Caching System (Basic built-in cache to reduce API calls).
  • Zero dependencies (Standalone – No external dependencies required).

Amazon Creators API PHP

⚡ Installing

Using Composer:

composer require jakiboy/apaapi

Without Composer:

  • 1 - Download repository ZIP (Latest version).
  • 2 - Extract ZIP (apaapi-main).
  • 3 - Include this lines beelow (apaapi self-autoloader).
include('apaapi-main/src/Autoloader.php');
\Apaapi\Autoloader::init();

⚡ Requirements

  • PHP ^8.2
  • cURL | Stream (file)

⚡ Getting Started

Variables:

  • "CREDENTIAL_ID" : From your Amazon Creators API (your locale), More.

  • "CREDENTIAL_SECRET" : From your Amazon Creators API (your locale), More.

  • "_TAG_" : From your Amazon Associates (your locale), More.

  • "_LOCALE_" : TLD of the target marketplace to which you are sending requests (com/fr/co.jp), Get TLD.

  • "_KEYWORDS_" : What you are looking for (Products), More.

  • "_ASIN_" : Accepts (ISBN), Amazon Standard Identification Number (your locale), More.

  • "_NODE_" : Browse Node ID (your locale), More.

Quickstart

Recommended using Apaapi Builder or Apaapi Product (Scraped data) if you dont have API credentials.

Product

Builder:

/**
 * @see Use Composer, 
 * Or include Apaapi Autoloader Here.
 */

use Apaapi\includes\Builder;

// (1) Init request builder
$builder = new Builder('_CREDENTIAL_ID_', '_CREDENTIAL_SECRET_', '_TAG_', '_LOCALE_');

// (2) Get response (Search)
$data = $builder->searchOne('Sony Xperia 1 VI'); // Normalized array

Note

See full builder usage at /wiki/Builder and use case /examples

Product:

/**
 * @see Use Composer, 
 * Or include Apaapi Autoloader Here.
 */

use Apaapi\includes\Product;

// (1) Init product
$product = new Product('B00NLZUM36', 'com', 'test-21');

// (2) Get response
$data = $product->get(); // Array

Note

See full product usage at /wiki/Product

Rating:

Get customer reviews of product as average rating and count (Scraped data).

Rating

use Apaapi\includes\Rating;

// Init Rating
$rating = new Rating('B00NLZUM36', 'com', 'test-21');

// Get Response
$data = $rating->get(); // Array

Cart:

Get affiliate cart URL.

Cart

use Apaapi\lib\Cart;

// Init Cart
$cart = new Cart();
$cart->setLocale('com')->setPartnerTag('test-21');

// Get Response
$data = $cart->set(['B00NLZUM36' => 3]); // String

⚡ Advanced

Basic (Search):

Extensible search method.

use Apaapi\operations\SearchItems;
use Apaapi\lib\Request;
use Apaapi\lib\Response;

// (1) Set operation
$operation = new SearchItems();
$operation->setPartnerTag('_TAG_')->setKeywords('_KEYWORDS_');

// (2) Prapere request
$request = new Request('_CREDENTIAL_ID_', '_CREDENTIAL_SECRET_');
$request->setLocale('_LOCALE_')->setPayload($operation);

// (3) Get response
$response = new Response($request);
$data = $response->get(); // Array

Note

See all available TLDs used by setLocale() at /wiki/TLDs

Basic (Get):

Extensible get method.

use Apaapi\operations\GetItems;
use Apaapi\lib\Request;
use Apaapi\lib\Response;

// Set operation
$operation = new GetItems();
$operation->setPartnerTag('_TAG_')->setItemIds(['_ASIN_']);

// Prapere request
$request = new Request('_CREDENTIAL_ID_', '_CREDENTIAL_SECRET_');
$request->setLocale('_LOCALE_')->setPayload($operation);

// Get response
$response = new Response($request);
$data = $response->get(); // Array

Operations:

All available operations.

use Apaapi\operations\GetItems;
use Apaapi\operations\SearchItems;
use Apaapi\operations\GetVariations;
use Apaapi\operations\GetBrowseNodes;

// (1) GetItems
$operation = new GetItems();
$operation->setPartnerTag('_TAG_');
$operation->setItemIds(['_ASIN_']); // Array

// (2) SearchItems
$operation = new SearchItems();
$operation->setPartnerTag('_TAG_');
$operation->setKeywords('_KEYWORDS_'); // String

// (3) GetVariations
$operation = new GetVariations();
$operation->setPartnerTag('_TAG_');
$operation->setASIN('_ASIN_'); // String

// (4) GetBrowseNodes
$operation = new GetBrowseNodes();
$operation->setPartnerTag('_TAG_');
$operation->setBrowseNodeIds(['_NODE_']); // Array

Resources:

Optimize response time by setting only the needed resources.

use Apaapi\operations\SearchItems;

// Set Operation
$operation = new SearchItems();
$operation->setPartnerTag('_TAG_')->setKeywords('_KEYWORDS_');

// Set Resources (3)
$operation->setResources(['images.primary.small', 'itemInfo.title', 'offersV2.listings.price']);

Note

See all available resources used by setResources() at /wiki/Resources

Authors

⭐ Support:

Skip the coffee! If you like the project, a Star would mean a lot.

Important

The Amazon logo included in top of this page refers only to the Amazon Creators API, Amazon Inc. or its affiliates.

jakiboy/apaapi 适用场景与选型建议

jakiboy/apaapi 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.07k 次下载、GitHub Stars 达 54, 最近一次更新时间为 2019 年 09 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「api」 「product」 「amazon」 「apaapi」 「amazon-affiliate-program」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 jakiboy/apaapi 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 jakiboy/apaapi 我们能提供哪些服务?
定制开发 / 二次开发

基于 jakiboy/apaapi 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 5.07k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 54
  • 点击次数: 9
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 54
  • Watchers: 4
  • Forks: 11
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-09-30