satishsinghdevbha / amazon-mws-laravel
用于 Amazon MWS 网络服务的 Laravel 库,支持 Laravel 5-7+
Requires
- php: >=7.3
- ext-curl: *
- illuminate/support: ^8.0
- symfony/http-kernel: ^5.0
Requires (Dev)
- illuminate/http: ^8.0
- illuminate/routing: ^8.0
- illuminate/view: ^8.0
- mockery/mockery: ^1.3.1
- phpunit/phpunit: ^9.0
- vlucas/phpdotenv: ^5.0
- dev-master
- 8.x-dev
- 8.0.7
- 8.0.6
- 8.0.5
- 8.0.4
- 8.0.3
- 8.0.2
- 8.0.1
- 8.0.0
- 7.x-dev
- 7.2.1
- 7.2.0
- 7.1.9
- 7.1.8
- 7.1.7
- 7.1.6
- 7.1.5
- 7.1.4
- 7.1.3
- 7.1.2
- 7.1.1
- 7.1.0
- 7.0.5
- 7.0.4
- 7.0.3
- 7.0.2
- 7.0.1
- 7.0.0
- 5.x-dev
- 5.0.2
- 5.0.1
- 5.0.0
- v4.1.5
- v4.1.4
- v4.1.3
- v4.1.2
- v4.1.1
- v4.1.0
- v4.0.9
- v4.0.8
- v4.0.7
- v4.0.6
- v4.0.5
- v4.0.4
- v4.0.3
- v4.0.2
- v4.0.1
- v4.0.0
- 3.0.2
- 3.0.1
- 3.0.0
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.0.1
- 1.0.0
This package is not auto-updated.
Last update: 2024-10-03 02:17:59 UTC
README
Amazon MWS for Laravel
============
计划迁移到新的 Selling Partner API?请查看我们的Amazon Selling Partner API 的 PHP SDK,以及我们的Laravel 封装器。
一个用于连接到 Amazon 商家网络服务的 Laravel 包。
如果你使用的是 Laravel 6 或更低版本,请使用版本 5.0。在 Laravel 7 上,请使用版本 7.0+。
这不是 Amazon Web Services (AWS) - 云计算服务。
安装
使用 composer require keithbrink/amazon-mws-laravel 安装此包。
对于 Laravel 5.5 及更高版本,包将自动被发现。对于其他版本,您可以将 KeithBrink\AmazonMws\MwsServiceProvider 添加到您的 config/app.php 文件中。
运行 php artisan vendor:publish --provider="KeithBrink\AmazonMws\MwsServiceProvider" --tag="config" 以将 amazon-mws.php 配置文件添加到您的配置目录。
用法
使用对象的一般工作流程如下
- 为需要执行的任务创建一个对象。
- 使用 set____ 方法根据对象加载参数。
- 将请求提交给 Amazon。通常使用命名 fetch____ 或 submit____ 的方法来完成此操作,并且没有参数。
- 使用 get____ 方法引用返回的数据,无论是单个值还是批量。
- 使用内置的日志系统监控库的性能。
请注意,如果您想对多个 Amazon 商店采取行动,您将为每个商店需要单独的对象。
请注意,当对象不被视为可重用时,它们表现最佳。否则,如果新请求失败,您可能会抓取旧响应数据。
如果您想了解如何使用特定功能,最好的方法是阅读函数上方的注释;它们详细且有帮助。
动态配置
如果您想将用于 Amazon 调用的配置信息更改为配置文件中的信息之外的内容,您可以将 setConfig($config) 函数添加到任何调用中。参数 $config 应该是一个数组,格式如下
$config = [ 'merchantId' => '', 'marketplaceId' => '', 'keyId' => '', 'secretKey' => '', 'amazonServiceUrl' => '', ];
示例用法
以下是一些使用此库的示例。
以下是一个示例函数,用于获取过去 24 小时内更新的所有仓库完成的订单
use KeithBrink\AmazonMws\AmazonOrderList; function getAmazonOrders() { $amz = new AmazonOrderList("myStore"); //store name matches the array key in the config file $amz->setLimits('Modified', "- 24 hours"); $amz->setFulfillmentChannelFilter("MFN"); //no Amazon-fulfilled orders $amz->setOrderStatusFilter( array("Unshipped", "PartiallyShipped", "Canceled", "Unfulfillable") ); //no shipped or pending $amz->setUseToken(); //Amazon sends orders 100 at a time, but we want them all $amz->fetchOrders(); $orders = []; foreach($amz->getList() as $order) { $orders = $order->getData(); } return $orders; }
此示例显示了用于向 Amazon 发送先前创建的 XML 饲料以更新库存编号的函数,并包括动态配置的示例
use KeithBrink\AmazonMws\AmazonFeed; function sendInventoryFeed($feed) { $config = [ 'merchantId' => '', 'marketplaceId' => '', 'keyId' => '', 'secretKey' => '', 'amazonServiceUrl' => '', ]; $amz = new AmazonFeed("myStore"); //store name matches the array key in the config file $amz->setConfig($config); $amz->setFeedType("_POST_INVENTORY_AVAILABILITY_DATA_"); //feed types listed in documentation $amz->setFeedContent($feed); $amz->submitFeed(); return $amz->getResponse(); }
致谢
此包是从以下地址分叉的: https://github.com/sonnenglas/amazon-mws-laravel
它又是从以下地址分叉的: https://github.com/creacoon/amazon-mws-laravel
它又是从以下地址分叉的: https://github.com/CPIGroup/phpAmazonMWS
该包的原始创建者是。