1. Go to this page and download the library: Download earc/data-elasticsearch 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/ */
earc / data-elasticsearch example snippets
use eArc\Data\Initializer;
Initializer::init();
use eArc\DataElasticsearch\ParameterInterface;
$hosts = ['https://user:[email protected]:32775'];
di_set_param(ParameterInterface::CLIENT_HOSTS, $hosts);
use eArc\Data\ParameterInterface;
use eArc\DataElasticsearch\ElasticsearchDataBridge;
di_tag(ParameterInterface::TAG_ON_PERSIST, ElasticsearchDataBridge::class);
di_tag(ParameterInterface::TAG_ON_REMOVE, ElasticsearchDataBridge::class);
di_tag(ParameterInterface::TAG_ON_FIND, ElasticsearchDataBridge::class);
use eArc\DataElasticsearch\IndexService;
di_get(IndexService::class)->rebuildIndex([
// list of your entity classes
]);
use eArc\DataElasticsearch\ParameterInterface;
di_set_param(ParameterInterface::INDEX_PREFIX, 'my-index-prefix');
use eArc\DataElasticsearch\ParameterInterface;
use eArc\DataElasticsearchTests\Entities\BlacklistedEntity;
di_set_param(ParameterInterface::WHITELIST, [
// list of entity class names
BlacklistedEntity::class => true,
// ...
]);
use eArc\DataElasticsearch\ParameterInterface;
di_set_param(ParameterInterface::BLACKLIST, [
// list of entity class names
Attribute::class => true,
// ...
]);
use eArc\DataElasticsearch\DocumentFactory;
di_decorate(DocumentFactory::class, MyDocumentFactory::class);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.