Skip to content

otis22/reverso

Repository files navigation

otis22/reverso

EO badge

Library for working with context.reverso.net api

GitHub CI Coverage Status

How to use

composer require otis22/reverso

Be careful library can translate only one a single word

Available language list: en, fr, es, de, it, pt, ru, ro, cz, zh

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.'
        ],
        ...
    ]
*/

Why it looks so?(In Russian)

Contributing

For run all tests

make all

or connect to terminal

make exec

Dafault php version is 7.4. Use PHP_VERSION= for using custom version.

make all PHP_VERSION=8.0
# run both 
make all PHP_VERSION=7.4 && make all PHP_VERSION=8.0

all commands

# composer install
make install
# composer install with --no-dev
make install-no-dev
# check code style
make style
# fix code style
make style-fix
# run static analyze tools
make static-analyze
# run unit tests
make unit
#  check coverage
make coverage