A PHP/Laravel Wrapper for oxford dictionary API
First, install the package through Composer.
composer require inani/oxfordapi-wrapper
Then include the service provider inside config/app.php.
'providers' => [
...
Inani\OxfordApiWrapper\OxfordWrapperServiceProvider::class,
...
];
At least set up in the env file
OXFORD_API_BASE_URI =
OXFORD_APP_ID =
OXFORD_APP_KEY =
make a new instance
// Make it or pass it as argument
$oxford = app(Inani\OxfordApiWrapper\OxfordWrapper::class);
// look for the translation from a language to an other, returns a parser
$parser =$oxford->lookFor('balablabla')
->from('en')
->to('es')
->translate();
// get array of translations
$translations = $parser->get();
// get array of [example => [translations]]
$examples = $parser->getExamples();
// look for the definitions of a word, returns a parser
$parser =$oxford->lookFor('balablabla')
->define();
// get array of definitions
$definitions = $parser->get();
// look for the examples of a word, returns a parser
$parser =$oxford->lookFor('balablabla')
->examples();
// get array of examples
$definitions = $parser->get();
// You can try all combinations
$res = $oxford->lookFor('happy')
->synonym()
->antonym()
->fetch();
// results will be related to (syno or anto)
// get synonyms and/or antonyms
$res->get();
// get only antonyms or null if not specfied in fetch
$res->antonyms();
//get only synonyms or null if not specfied in fetch
$res->synonyms();