subbe/semantics3

此包已被废弃且不再维护。未建议替代包。

最全面的产品API套件

1.0 2016-08-05 04:19 UTC

This package is not auto-updated.

Last update: 2018-12-22 17:17:32 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

Semantics3 是一个使用 lib\semantics3 PHP 库构建的 laravel 包,它提供了对 Semantics3 API 的访问,该 API 允许您检索数百万产品的元数据。

安装

1 -

打开终端并从项目的根目录开始:

composer require subbe/semantics3
2 -

打开文件 config\app.php

将以下行添加到 providers 数组中

Subbe\Semantics3\Semantics3ServiceProvider::class,

3 -

php artisan vendor:publish

运行此命令将在项目的配置文件夹中发布 semantics3config.php。该文件返回一个包含 2 个值的数组,'SEMANTICS3_SECRET_KEY' 和 'SEMANTICS3_PUBLIC_KEY'。

4 -

要使用此包,您需要在 semantics3 上注册。

注册并登录后,转到 应用,您将找到使用 API 所需的密钥。

根据需要更新项目的 .env 文件,它应类似于以下内容。

SEMANTICS3_SECRET_KEY=ZHFAJHS************
SEMANTICS3_PUBLIC_KEY=SEM****************

用 Semantics3 提供的密钥替换密钥。

使用

添加以下内容:

use Subbe\Semantics3\Semantics3;

Semantics3::search($item);

$item = Semantic3::search('iphone');

这将根据搜索词 'iphone' 返回产品信息。

Semantics3::brand($item);

$item = Semantic3::brand('apple');

这将根据品牌名称 'apple' 返回产品信息。

Semantics3::upc($item);

$item = Semantic3::upc('0885909950942');

这将根据 UPC/EAN/GTIN '0885909950942' 返回产品信息。

Semantics3::site_query($item, $site);

$item = Semantics3::site_query('iphone', 'amazon.com');

这将根据网站 'amazon.com' 的搜索词 'iphone' 返回产品信息。

或者,您可以使用如下方式:

$sem = new Semantics3();
$search = $sem->search('iphone');
$upc = $sem->upc('0885909950942');
$site = $sem->site_query('iphone', 'amazon.com');
$site = $sem->categories('hard drives');

谢谢