ckdot/awin-product-sdk
Composer 安装命令:
composer require ckdot/awin-product-sdk
包简介
An inofficial PHP SDK to grab product data from Awin.
README 文档
README
An inofficial PHP SDK to grab product data from Awin.
Installation
composer require ckdot/awin-product-sdk
Usage
<?php use AwinProductSdk\ValueObjects\Advertiser; use AwinProductSdk\ValueObjects\Product; require_once 'vendor/autoload.php'; $apiKey = 'your-api-key'; $factory = new \AwinProductSdk\Factory\Factory(); $config = new \AwinProductSdk\ValueObjects\Config( 'https://productdata.awin.com/datafeed/list/apikey/' . $apiKey, new \Symfony\Component\Cache\Simple\FilesystemCache() ); $aWin = $factory->createFacade($config); $advertisers = $aWin->getAdvertisers(); $activeAdvertisers = $aWin->filterAdvertisers(Advertiser::KEY_STATUS, 'active', $advertisers); /** * @var Advertiser $advertiser */ foreach ($activeAdvertisers as $index => $advertiser) { $products = $aWin->getProducts($advertiser); $shirts = $aWin->filterProductsByRegExp(Product::KEY_NAME, '/shirt/i', $products); echo $advertiser->getId().': ' . $advertiser->getName() .PHP_EOL; /** * @var Product $shirt */ foreach ($shirts as $shirt) { echo '- ' . $shirt->getId() . ': ' . $shirt->getName().PHP_EOL; } }
How it works
The SDK is using the Awin product feed CSV files to read out advertiser and product data. Basically parsing of these data is quite fast but still you should be aware that some product feeds have a size of several megabytes. So I recommand to fetch data via SDK in background (cronjob) and store them into your own database. Make sure you set the memory limit of your PHP instance to a proper size.
Documentation
There is no documention. If you want to know how it works in detail, read the code.
License
统计信息
- 总下载量: 64
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-08-28