承接 matsevh/matsevhsearch 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

matsevh/matsevhsearch

最新稳定版本:1.0.1

Composer 安装命令:

composer require matsevh/matsevhsearch

包简介

Thin & minimal low-level HTTP client to interact with MatseVHSearch's API

README 文档

README

The perfect starting point to integrate MatseVHSearch within your PHP project

Latest Stable Version Latest Unstable Version Total Downloads License PHP Version Require

✨ Features

  • Thin & minimal low-level HTTP client to interact with MatseVHSearch's API
  • Supports php >=7.4.

💡 Getting Started

First, install MatseVHSearch PHP API Client via the composer package manager:

composer require matsevh/matsevhsearch

Then you can use it in your project:

// Require the autoloader from the composer
require_once 'vendor/autoload.php';

// Use the MatseVHSearch PHP API Client
use MatseVH\MatseVHSearch\SearchClient;

// Instantiate the client
$client = new SearchClient('<application_id>', '<api_key>');

// Add the function you want to use (You can find the function below)

Functions:

Push:

// Push some data to the index -> products
// It doesn't matter if the data is already in the index
// The already existing data will be deleted and replaced by the new data
// You can push a PHP array or a JSON string array
$php = array(
    array(
        'objectID' => '1',
        'title' => 'My first object',
        'description' => 'This is my first object',
        'price' => '10.00',
        'currency' => 'EUR',
        'image' => 'https://example.com/image.jpg',
        'url' => 'https://example.com/product/1',
        'brand' => 'My brand',
        'category' => 'My category',
        'tags' => array('tag1', 'tag2'),
        'attributes' => array(
            'attribute1' => 'value1',
            'attribute2' => 'value2'
        )
    ),
    array(
        'objectID' => '2',
        'title' => 'My second object',
        'description' => 'This is my second object',
        'price' => '20.00',
        'currency' => 'EUR',
        'image' => 'https://example.com/image.jpg',
        'url' => 'https://example.com/product/2',
        'brand' => 'My brand',
        'category' => 'My category',
        'tags' => array('tag1', 'tag2'),
        'attributes' => array(
            'attribute1' => 'value1',
            'attribute2' => 'value2'
        )
    )
);

// In json format it would look like this:
$json = '[
          {
            "objectID":"1",
            "title":"My first object",
            "description":"This is my first object",
            "price":"10.00",
            "currency":"EUR",
            "image":"https://example.com/image.jpg",
            "url":"https://example.com/product/1",
            "brand":"My brand",
            "category":"My category",
            "tags":["tag1","tag2"],
            "attributes":{
              "attribute1":"value1",
              "attribute2":"value2"
            }
          },
          {
            "objectID":"2",
            "title":"My second object",
            "description":"This is my second object",
            "price":"20.00",
            "currency":"EUR",
            "image":"https://example.com/image.jpg",
            "url":"https://example.com/product/2",
            "brand":"My brand",
            "category":"My category",
            "tags":["tag1","tag2"],
            "attributes":{
              "attribute1":"value1",
              "attribute2":"value2"
            }
          }
        ]';

// Push the data to the index -> products
$client->push('products', $php); // or $client->push('products', $json);

Search:

// Search for products
$results = $client->search('products', 'My first object');

Get:

// Get all the pushed data from the index -> products
$results = $client->get('products');

Reverse:

// Get all the pushed data reversed from the index -> products
$results = $client->reverse('products');

Random:

// Get all the pushed data in random order from the index -> products
$results = $client->random('products');

Need help? Contact me by email: matse@vanhorebeek.be

📄 License

MatseVHSearch PHP API Client is an open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-08-06