PHP code example of otis22 / reverso

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

    

otis22 / reverso example snippets


use Otis22\Reverso\Context;

$context = Context::fromLanguagesAndWord("ru", "en", "пример");

$context->original(); # return "пример"

$context->firstInDictionary(); # return "example" word, because it is the most popular variant in the reverso.net

$context->dictionary(); #return synonyms array ['example', 'sample', 'case', ...]

$context->examples(); #return examples sentences
/** 
    [
        [
            'source' => 'Красивый <em>пример</em> - прошлогодняя эпидемия свиного гриппа.',
            'target' => 'So a nice <em>example</em> of this came from last year and swine flu.'
        ],
        ...
    ]
*/