PHP wrapper to communicate with the Oxford Dictionary API. This wrapper will only work with V2 of the oxford API (V1 will be deprecated from June 2019 - so I have removed support from here also)
- Easily obtain definitions, derivatives, origins, example text and audio pronunciations for a specified word
- Better error reporting/handling
- Iterate through result sets (where words have more than 1 definition eg 'bark')
- Boolean function to determine if word is valid
- Convert inflections. Some words are inflections, e.g., running, which don’t have an entry in the dictionary of their own. In this case, we should use the Lemmas endpoint to retrieve the root form, which converts the word to something useable, e.g., running becomes run.
- Translations
- Thesaurus
- Check the
test.phpfile to see how to implement the Oxford Dictionary V2 API =>dictionary.class.phpor follow the instructions below:
- Get your free Oxford Dictionary API and APP keys from https://developer.oxforddictionaries.com/
- To use V2 of their API you must register either a Developer or Prototype account (Prototype is free)
- Include the
dictionary.class.phpfile usinginclude_once './dictionary.class.php'; - Initialise a new instance of the dictionary:
$dictionary = new dictionary("YOUR APP ID", "YOUR APP KEY", "LANGUAGE"); - For a list of supported languages please see https://developer.oxforddictionaries.com/documentation/languages
- Pass a word to the dictionary:
$dictionary->getWord("pizza"); - Choose the result set to use (this step is optional. If not used, the default (first) result set will be used)
$dictionary->setResult(1); - Use the class functions to return data:
echo $dictionary->getDefinition();