PHP code example of sjaakmoes / elasticsearch-langdetect-php

1. Go to this page and download the library: Download sjaakmoes/elasticsearch-langdetect-php 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/ */

    

sjaakmoes / elasticsearch-langdetect-php example snippets


$params = [
    'host'              => ['localhost:9200'],
    'customNamespaces'  => [
        'langdetect'    => 'Langdetect\LangdetectNamespace'
    ]
];
$client = new Elasticsearch\Client($params);

// Detect
$params = [
    'content'   => 'This is a sample text.'
];
$response = $client->langdetect()->detect($params);
json
{
    "jaakmoes/elasticsearch-langdetect-php": "~1.0"
    }
}
$response