Skip to content
This repository has been archived by the owner. It is now read-only.
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
49 lines (35 sloc) 1.97 KB


Build Status Scrutinizer Quality Score Latest Stable Version Total Downloads

A PHP client for the Forage search server

License: MIT


$ composer require vierbergenlars/forage-client:~0.2@alpha

Usage example


use vierbergenlars\Forage\Transport\Http as HttpTransport;
use vierbergenlars\Forage\Client;

$transport = new HttpTransport;
$client = new Client($transport);

$query = $client->createQueryBuilder()
               ->setSearchQuery('Funny cat')
               ->addFilter('animal', 'cat')
               ->addFilter('categories', array('funny', 'lol'))
               ->addWeight('title', 3)

$results = $query->execute();

echo 'Total hits: '.$results->getTotalHits();
foreach($result as $hit) {
    /* @var $hit \vierbergenlars\Forage\SearchResult\Hit */
    echo ' - '.$hit->getDocument()['title'].' (score: '.$hit->getScore().'; id='.$hit->getId().')';

Full documentation is available in the wiki, or have a look at the API documentation

You can’t perform that action at this time.