findologic/findologic-api

Library for FINDOLOGIC API requests

v2.0.0 2023-06-19 14:30 UTC

README

Tests codecov Packagist

Synopsis

FINDOLOGIC-API is an object oriented wrapper for the Findologic API, with over 300 automated unit-tests and 100% code coverage.

This library not only helps requesting the Findologic API, but also getting data from the response and mapping them to corresponding objects. You won't have to mess around with sending requests and getting the data from the Findologic's response anymore.

You want to get filters? Just call Response::getMainFilters(). It really is that simple, just try out the Basic Usage or see some Examples.

To have a better understanding about the API, please make sure to read the general Findologic API documentation. We already got you covered with quicklinks to it:

Limitations

Currently, we support the following response formats:

Requirements

Installation

For a simple installation you can use Composer. Using this command will install the latest version.

composer require findologic/findologic-api

Basic usage

The usage is pretty simple. Here is an example:

// Require composer autoload
require_once __DIR__ . '/vendor/autoload.php';

use FINDOLOGIC\Api\Config;
use FINDOLOGIC\Api\Client;
use FINDOLOGIC\Api\Requests\Request;
use FINDOLOGIC\Api\Requests\SearchNavigation\SearchRequest;
use FINDOLOGIC\Api\Responses\Json10\Json10Response;

// Set your ServiceId/Shopkey, which can be found in the customer account.
$config = new Config('ABCDABCDABCDABCDABCDABCDABCDABCD');
$client = new Client($config);

/** @var SearchRequest $request */
$request = Request::getInstance(Request::TYPE_SEARCH);
$request->setQuery('shirt') // Users search query.
    ->setShopUrl('blubbergurken.de') // Url of the shop.
    ->setUserIp('127.0.0.1') // Users IP.
    ->setReferer($_SERVER['HTTP_REFERER']) // Page where search was fired.
    ->setRevision('1.0.0') // Version of your API wrapper.
    ->setOutputAdapter('JSON_1.0'); // Optional setting of output format.

/** @var Json10Response $response */
$response = $client->send($request);

var_dump($response->getResult()->getItems()); // Get all products/items.
var_dump($response->getResult()->getMainFilters()); // Get all main filters easily.
var_dump($response->getResult()->getOtherFilters()); // Get all other filters easily.
var_dump($response); // Entire response, full of helper methods.

Examples

  • Working examples can be found in the /examples directory.
  • The documentation can be found in our Project Wiki.

Projects using this library

Bug Report

We need your help! If you find any bug, please submit an issue and use our template! Be as precise as possible so we can reproduce your case easier. For further information, please refer to our issue template at .github/ISSUE_TEMPLATE/bug_report.md.

Contributing

Please check our contribution guide on how to contribute.