PHP code example of synida / hunspell-php-wrapper

1. Go to this page and download the library: Download synida/hunspell-php-wrapper 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/ */

    

synida / hunspell-php-wrapper example snippets


composer 

$results = (new HunSpell(
    // encoding
    'en_GB.utf8',
    // dictionary file name without extension 
    'en_GB', 
    // response type
    HunSpell::JSON_RESPONSE, 
    // max threads - ignored if the parallel module is dissabled
    1, 
    // optimal minimum thread words - ignored if the thread number is 1
    Configuration::MIN_WORD_PER_THREAD
))->suggest();

$dictionaryEditor = new DictionaryEditor();

if (!$dictionaryEditor->addWord($path, $word)) {
    echo $dictionaryEditor->getMessage();
}

$dictionaryEditor = new DictionaryEditor();

if (!$dictionaryEditor->deleteWord($path, $word)) {
    echo $dictionaryEditor->getMessage();
}

$dictionaryEditor = new DictionaryEditor();

if (!$dictionaryEditor->editWord($path, $word, $modifiedWord)) {
    echo $dictionaryEditor->getMessage();
}