Appearance
Search Term Prediction with our PHP client
Looking for setup prerequisites, authentication details, and package references? Start with the PHP SDK landing page.
Start by making a Searcher-instance.
php
use Relewise\Searcher;
// You have to `use` the above to create a Searcher.
$searcher = new Searcher(
"00000000-0000-0000-0000-000000000001",
"your API Key");
$searcher->serverUrl = "the server URL for the dataset";To make requests with the SDK you need to use the types from our PHP SDK. The types are located in the namespace Relewise\Models and an example of using a concrete type could be the following:
php
use Relewise\Models\ProductSearchRequest;Before going any further, read about handling different types of users here.
Also remember to specify your Server URL in your request.
The following shows an example on how to perform search term predictions with Relewise:
php
$request = SearchTermPredictionRequest::create(
Language::create("da"),
Currency::create("DKK"),
$this->getUser(),
"Search overlay",
"kan",
take: 10
);
$response = $searcher->searchTermPrediction($request);