PHP code example of phil / search-synonyms

1. Go to this page and download the library: Download phil/search-synonyms 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/ */

    

phil / search-synonyms example snippets


use Phil\SearchSynonyms\Infrastructure\Format\SolrSynonymsReader;
use Phil\SearchSynonyms\Infrastructure\Store\FileSynonymStore;

$list = new SolrSynonymsReader()->read("jdr, jeu de rôle\ndonjon => donjon, dungeon\n", 'fr');
$store = new FileSynonymStore(__DIR__.'/config/synonyms');
$store->save($list);            // config/synonyms/fr.txt
$store->get('fr-CA')->sets;     // the two rules