exclusivedev / laravel-amazon-mws
使用Laravel 5/6/7/8版本的Amazon MWS网络服务,基于sonnenglas/amazon-mws-laravel和creacoon/amazon-mws-laravel包,并修改以使其与最新的Laravel版本兼容(+设置text/xml头部的bug修复)。
3.1.1
2019-12-03 13:30 UTC
Requires
- php: >=5.5.9
- ext-curl: *
- illuminate/support: 5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|6.*.*
This package is not auto-updated.
Last update: 2024-09-24 21:15:49 UTC
README
这是一个Laravel包,用于以面向对象的方式连接到Amazon的Merchant Web Services (MWS),注重直观使用。基于sonnenglas/amazon-mws-laravel和creacoon/amazon-mws-laravel包,并修改以使其与最新的Laravel版本兼容+设置text/xml头部的bug修复。
这不是Amazon Web Services (AWS) - 云计算服务。
安装
-
composer require exclusivedev/laravel-amazon-mws
-
将服务提供者添加到config/app.php中的providers数组
ExclusiveDev\AmazonMws\ServiceProvider::class,
- 将配置文件复制到Laravel的配置目录。
php artisan vendor:publish --provider="ExclusiveDev\AmazonMws\ServiceProvider"
示例用法
这里有一些使用此库的示例。所有API所需的详细技术信息都在幕后处理,因此用户可以轻松构建发送请求到Amazon的代码,而无需跨越参数URL格式化和令牌管理等障碍。
以下是一个函数的示例,用于获取过去24小时内更新的所有由仓库完成的订单
use ExclusiveDev\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(); return $amz->getList(); }
此示例展示了用于将之前创建的XML馈送发送到Amazon以更新库存数量的函数
use ExclusiveDev\AmazonMws\AmazonOrderList; function sendInventoryFeed($feed) { $amz = new AmazonFeed("myStore"); //store name matches the array key in the config file $amz->setFeedType("_POST_INVENTORY_AVAILABILITY_DATA_"); //feed types listed in documentation $amz->setFeedContent($feed); $amz->submitFeed(); return $amz->getResponse(); }