uam/aws-ecs-client

用于 AWS 电子商务服务(Amazon 产品广告 API)的 PHP 客户端库

0.1.6 2013-06-23 14:24 UTC

This package is auto-updated.

Last update: 2024-08-29 04:03:19 UTC


README

此库提供了一个用于 Amazon 产品广告 API 的 PHP 客户端。

它设计用来模仿 AWS PHP SDK v2。

安装

通过 composer

将库包添加到您的 composer.json 文件中

	require: {
		…
		"uam/aws-ecs-client": "dev-master"
	}

使用方法

<?php

use UAM\Aws\Ecs\Aws;

$client = Aws::factory('path/to/config.php')->get({service});

其中 {service} 是根据配置请求的服务名称。

配置

配置文件可以写为 PHP 数组或 json 文件。传递给 Aws::factory 方法的配置可以采取以下三种形式之一

服务

包含一个 services 键的标准 Guzzle 配置数组。请参阅 Guzzle 文档。

多个商店

包含一个 stores 键的数组,其值是一个数组,其中

  • 键是服务名称
  • 值是传递给服务的参数数组

将为 stores 数组中的每个键创建一个 Guzzle 服务。

单个商店

否则,数组被视为表示单个 Guzzle 服务的参数。如果存在,服务名称等于 name 配置选项的值,否则默认为 "ecs"。

配置参数

每个服务的配置参数是

  • key: 您的 AWS 访问密钥 ID
  • associate_tag: 您的 Amazon 产品广告关联标签或跟踪 ID
  • region: 一个表示要使用的 Amazon 商店地区的字符串。允许的值有:ca、cn、de、es、fr、it、jp、uk、us。

示例配置

服务

<?php

$services = array(
	"amazon.fr" => array(
		"class" => "UAM\Aws\Ecs\EcsClient",
		"params" => array(
			"key" => "Your AWS Access Key Id",
			"associate_tag" => "your associate tag or tracking id",
			"region" => "fr"
		)
	),
	"amazon.us" => array(
		"class" => "UAM\Aws\Ecs\EcsClient",
		"params" => array(
			"key" => "Your AWS Access Key Id",
			"associate_tag" => "your associate tag or tracking id",
			"region" => "us"
		)	
	)
);

多个商店

"stores": {
	"amazon.fr": {
		"key": "Your AWS Access Key Id",
		"associate_tag": "Your associate tag or tracking id",
		""region": "fr"
	},
	"amazon.us": {
		"key": "Your AWS Access Key Id",
		"associate_tag": "Your associate tag or racking id",
		"region": "us"
	}
}

单个商店

<?php

$config = array(
	"key" => "Your AWS Access Key Id",
	"associate_tag" => "Your associate tag or tracking id",
	"region" => "fr"
);

命名单个商店

"name": "amazon.fr",
"key": "Your AWS Access Key Id",
"associate_tag": "Your associate tag or tracking id",
"region": "fr"