logshub / search-client-php
There is no license information available for the latest version (1.3) of this package.
1.3
2019-04-11 13:33 UTC
Requires
- guzzlehttp/guzzle: ^6.3
- symfony/console: *
Requires (Dev)
- phpunit/phpunit: ^7
This package is auto-updated.
Last update: 2025-04-21 22:52:25 UTC
README
You can use it to manage your search services. This is main connector between your store and logshub.com search service. Most of the stores are written in PHP language, and we decided to create this connector to speed up integration.
Requirements
- PHP 5.5+, 7+
- composer - https://getcomposer.org/
Installation
composer require logshub/search-client-php
Test
make test
Example
<?php include_once 'vendor/autoload.php'; # you can find your service's details on your logshub.com dashboard. $location = 'uk01'; $serviceId = '5b5a06d2-23bc-4186-4d1b-3a17bfa7200d'; $apihash = 'xizinISDPH'; $apiSecret = 'ZJLnvZAujIBOTiJVyfImZYLEKdesJPKUntfFztYLiefQsCMgmd'; $client = \Logshub\SearchClient\Client::fromLocation( $location, $apihash, $apiSecret); $product = new \Logshub\SearchClient\Model\Product('1', [ 'name' => 'Laptop Full HD 8GB RAM', 'price' => 899 ]); $request = new \Logshub\SearchClient\Request\IndexProducts($serviceId, [ $product ]); $response = $client->indexProducts($request); echo $response->getBody() . PHP_EOL;
More info at the documentation.
Demo usage
Content of config file, required for demo
# example content of /etc/logshub-search.ini - replace with your details,
# that can be found on your logshub's service details page
serviceid = "5b5a06d2-23bc-4186-4d1b-3a17bfa7200d"
location = "uk01"
apihash = "xizinISDPH"
apisecret = "ZJLnvZAujIBOTiJVyfImZYLEKdesJPKUntfFztYLiefQsCMgmd"
Indexing
php vendor/bin/logshub-search index \
--config /etc/logshub-search.ini \
--id 4 \
--name "Laptop for gaming asus" \
--price 15.5
Searching
php vendor/bin/logshub-search search \
--config /etc/logshub-search.ini \
--query "laptop"
Indexing CSV file
php vendor/bin/logshub-search index:csv \ --config /etc/logshub-search.ini \ --csv /home/greg/products.csv
Licence
MIT