PHP code example of openeuropa / europa-search-client

1. Go to this page and download the library: Download openeuropa/europa-search-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

openeuropa / europa-search-client example snippets




$client = new \OpenEuropa\EuropaSearchClient\Client(
    new \GuzzleHttp\Client(),
    new \Http\Factory\Guzzle\RequestFactory(),
    new \Http\Factory\Guzzle\StreamFactory(),
    new \Http\Factory\Guzzle\UriFactory(),
    [
        // For a full list of options see "Configuration".
        'apiKey' => 'foo',
        'searchApiEndpoint' => 'https://example.com/search',
    ]
);

$response = $client->getInfo();

$response = $client->search('something to search');

$response = $client->getFacets('something to search');

$response = $client->ingestText('http://example.com/page/to/be/ingested', 'text to be ingested/index');

$binaryString = file_get_contents(...);
$client->ingestFile('http://example.com/file/to/be/ingested', $binaryString);

$success = $client->deleteDocument('referenceID');