sxqibo/fast-spapi

亚马逊SP-API客户端

v1.1 2025-08-08 07:46 UTC

This package is auto-updated.

Last update: 2025-08-08 07:50:01 UTC


README

亚马逊 SP-API 客户端库

版本信息

  • 当前版本: v2.0.0
  • PHP 要求: >= 7.4
  • 主要依赖: GuzzleHttp 7.x, PSR7 2.x

安装

composer require sxqibo/fast-spapi

快速开始

<?php

use Sxqibo\FastSpapi\Client;
use Sxqibo\FastSpapi\Credentials;

// 配置凭据
$credentials = [
    'refresh_token' => 'your_refresh_token',
    'lwa_app_id' => 'your_app_id',
    'lwa_client_secret' => 'your_client_secret',
    'aws_access_key_id' => 'your_aws_access_key',
    'aws_secret_access_key' => 'your_aws_secret_key',
    'role_arn' => 'your_role_arn',
];

$config = [
    'region' => 'us-east-1',
    'host' => 'sellingpartnerapi-na.amazon.com',
];

// 创建客户端
$client = new Client($credentials, $config);

// 使用 API
$response = $client->send('/catalog/v0/items', [
    'method' => 'GET',
    'query' => ['keywords' => 'test']
]);

Demo 和测试

完整的演示和测试文件位于 demo/ 文件夹中:

cd demo
php test_connection.php    # 连接测试
php demo_correct.php       # 完整功能测试

详细说明请查看 demo/README.md

升级指南

如果您从 v1.0.4 升级,请查看 UPGRADE.md 文件了解详细升级步骤。

主要变更

  • 升级到 GuzzleHttp 7.x 和 PSR7 2.x
  • 添加了 PSR7 兼容性层
  • 要求 PHP >= 7.4

功能特性

  • ✅ 完整的亚马逊 SP-API 支持
  • ✅ 自动身份验证和令牌管理
  • ✅ PSR-7 兼容的 HTTP 客户端
  • ✅ 支持所有 SP-API 端点
  • ✅ 现代化的依赖管理

许可证

MIT License