PHP code example of mettle / big-huge-thesaurus-client

1. Go to this page and download the library: Download mettle/big-huge-thesaurus-client 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/ */

    

mettle / big-huge-thesaurus-client example snippets


/**
 * Get the synonyms from the response
 */
$response->getSynonyms($type = null): array

/**
 * Get the antonyms from the response
 */
$response->getAntonyms($type = null): array

/**
 * Get the similar terms from the response
 */
$response->getSimilarTerms($type = null): array

/**
 * Get related terms from the response
 */
$response->getRelatedTerms($type = null): array

/**
 * Cast response to array (returns the original response)
 */ 
$response->toArray(): array

/**
 * Cast response to JSON
 */
$response->toJson()

try {
    $response = $client->lookup('love');
} catch (NotFoundException $ex) {
    // Not Found
} catch (UsageExceededException $ex) {
    // Usage exceeded
} catch (InactiveKeyException $ex) {
    // Key not active
} catch (MissingWordsException $ex) {
    // No words provided
} catch (NotWhitelistedException $ex) {
    // IP address blocked
}
 php
$API_KEY = 'Get an api key @ https://words.bighugelabs.com/api.php';

$client = new Mettleworks\BigHugeThesaurusClient\BigHugeThesaurusClient($API_KEY);
$response = $client->lookup('love');