phpscots / product-comparison
Flipkart、Amazon 和 Snapdeal 的产品搜索/广告包
dev-master
2019-12-07 15:46 UTC
Requires
- guzzlehttp/guzzle: 6.2.*
Requires (Dev)
- phpunit/phpunit: 5.7.*
This package is not auto-updated.
Last update: 2024-09-29 04:14:28 UTC
README
https://github.com/jsartisan/shopkart-laravel/
为 laravel 5.4 升级包
升级依赖项 phpunit 和 guzzle http
创建 Snapdeal 的支持
请勿使用,仍在开发中
Shopkart-Laravel 是一个用于通过 Laravel 调用 Flipkart 和 Amazon 搜索 API 的非常简单的包。安装 Shopkart-Laravel
通过 Composer 安装。
composer require phpscots/product-comparison dev-master
接下来,将服务提供者添加到 app/config/app.php。
# app.php 'providers' => [ // .. Phpscots\ProductSearch\ProductSearchServiceProvider::class, ]
还要添加外观。
# app.php 'aliases' => [ // .. 'ProductSearch' => Phpscots\ProductSearch\Facades\ProductSearch::class, ]
现在在 services.php 中添加您的 Flipkart 和 Amazon 分销商 ID 凭证。
# services.php // .. 'amazon' => [ 'client_id' => 'your_amazon_client_id', 'client_secret' => 'your_amazon_client_secret/', 'tag' => 'your_amazon_id_tag', 'country' => 'your_country_code' ], 'flipkart' => [ 'client_id' => 'your_flipkart_client_id', 'client_secret' => 'your_flipkart_client_secret', 'country' => '', 'tag' => '' ], 'snapdeal' => [ 'client_id' => 'your_snapdeal_client_id', 'client_secret' => 'your_snapdeal_client_secret', 'country' => '', 'tag' => '' ],
使用方法
Amazon API
要在 Amazon API 中搜索产品,请编写
ProductSearch::with('amazon')->search('PS3','Electronics');
这将根据关键字 'PS3' 返回产品列表。重要的是您必须传递 Amazon 搜索 API 请求的搜索索引,在我们的例子中是 'Electronics'。更多信息请查看这里 - 搜索索引。
Amazon 搜索方法的第一参数是关键字,第二个参数是搜索索引。
Flipkart API
要在 Flipkart API 中搜索产品,请编写
ProductSearch::with('flipkart')->search('PS3',5);
这将根据指定的关键字(在我们的例子中是 'PS3')从他们的 API 返回 Flipkart 产品列表。
Flipkart 搜索方法的第一参数是关键字,第二个参数是结果计数,即您从 API 中想要的产品数量。(最多 10 个)。