定制 ckdot/awin-product-sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

MIT: https://en.wikipedia.org/wiki/MIT_License

统计信息

  • 总下载量: 64
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-08-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固