haringsrob / icecat
Icecat 数据获取类
1.1.0
2021-10-07 10:38 UTC
Requires
- php: >=5.5.0
- guzzlehttp/guzzle: ~6.0|~7
Requires (Dev)
- phpmd/phpmd: ^2.6
- phpunit/phpunit: ~4.0
- squizlabs/php_codesniffer: ^3.0
This package is auto-updated.
Last update: 2024-09-07 16:49:11 UTC
README
Icecat 是一个 PHP 库,可以帮助您完成以下 2 个过程:
- 使用基本产品信息从 Icecat 数据库获取数据。
- 解析 Icecat 响应中的数据,并在实际应用中使用它们。
关于 Icecat
Icecat 是一个开放目录,提供对数千个产品数据表的免费访问。此外,当订阅时,可访问的数据表数量将增加。
有一个 Icecat 赞助品牌列表。
安装
可以使用 composer 安装此库
"haringsrob/icecat": "dev-master"
用法
在当前状态下,类库易于使用。
结果
负责解析数据的 Icecat 类 包含一些基本方法,但您可以通过实现 IcecatInterface 接口轻松创建自己的实现。
// Use the class. use haringsrob\Icecat\Model\Result; // See IcecatFetcher on how to get data or implement your own way. $data = $fetcher->getBaseData(); // Initialize. $icecat = new Result($data); // Brand name. e.g.: Acer $icecat->getSupplier(); // Long description of the product. $icecat->getLongDescription(); // Short description. $icecat->getShortDescription(); // The category the product belongs to. e.g.: Notebooks $icecat->getCategory(); // Returns maximum 5 images about the product (optional limit). $icecat->getImages(5); // Returns key => value array with specifications. e.g: ['cpu' => 'Core I5', 'screensize' => '15.6'] $icecat->getSpecs(); // Returns array with videos of the product. $icecat->getVideos(); // Returns array with manuals. $icecat->getManuals(); // Returns array with 360 images. $icecat->get360imageArray(); // Returns array with Reasons to Buy. $icecat->getReasonsToBuy();
演示即将推出。
获取器
负责从数据库获取数据的 IcecatFetcher。
// Use the class. use haringsrob\Icecat\Model\Fetcher; // Inititialize. $fetcher = new Fetcher( 'Username', 'Password', 'Ean', 'Language' ); // Fetch the actual data. $data = $fetcher->fetchBaseData();
集成
正在积极开发的 Drupal 模块。