PHP code example of reliefweb / api-indexer

1. Go to this page and download the library: Download reliefweb/api-indexer 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/ */

    

reliefweb / api-indexer example snippets


composer 

use RWAPIIndexer\Manager;

// Indexing options to index all reports.
$options = array(
  'bundle' => 'report',
  'elasticsearch' => 'http://127.0.0.1:9200',
  'mysql-host' => 'localhost',
  'mysql-port' => 3306,
  'mysql-user' => 'root',
  'mysql-pass' => '',
  'database' => 'DATABASE_NAME',
  'base-index-name' => 'ELASTICSEARCH_INDEX_PREFIX',
  'tag' => '',
  'website' => 'https://reliefweb.int',
  'limit' => 0,
  'offset' => 0,
  'chunk-size' => 500,
  'id' => 0,
  'remove' => FALSE,
  'alias' => TRUE,
);

// Create the indexing manager.
$manager = new Manager($options);

// Index or delete based on the provided options.
$manager->execute();