PHP code example of fsi / datasource-elastica-driver

1. Go to this page and download the library: Download fsi/datasource-elastica-driver 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/ */

    

fsi / datasource-elastica-driver example snippets


/**
 * This is the class that loads and manages your bundle configuration
 *
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
 */
class FsiDemoExtension extends Extension
{
    /**
     * {@inheritDoc}
     */
    public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

        $xmlLoader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $xmlLoader->load('elastica-driver.xml');
    }
}

$dataSource = $this->dataSourceFactory->createDataSource('elastica', [
    'searchable' => $elasticaIndex, // instance of \Elastica\SearchableInterface
    'query' => null,
    'filter' => null,
    'master_query' => null,
], 'datasource_id');

sh
docker-compose up
php vendor/bin/phpunit