PHP code example of makina-corpus / nucliadb-php-client
1. Go to this page and download the library: Download makina-corpus/nucliadb-php-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/ */
makina-corpus / nucliadb-php-client example snippets
use Nuclia\ApiClient;
$token = '<your-nucliadb-token>';
$kbid = '<your-nucliadb-knoledgebox-id>';
$zone = '<your-nucliadb-zone>'; //Such as 'europe-1'
$apiClient = new ApiClient($zone, $token, $kbid);
$searchApi = $apiClient->createSearchApi();
use Nuclia\Query\SearchQuery;
$response = $searchApi->search((new SearchQuery())->setQuery('you+shall+not+pass'));
$body = file_get_contents('The-Fellowship-Of-The-Ring.jpg', 'r');
$md5 = md5($body);
$rid = '<resource-id>'
$fieldId = '<field-id>' // A free string used to identify your file field in resource.
$response = $resourceFieldsApi->uploadBinaryFile($rid, $fieldId, $body, (new UploadBinaryFileHeaders())->setMd5($md5));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.