alanly / picnik
A modern, Composer and PSR-4 compatible PHP library for interfacing with the Wordnik API.
v0.1.5
2015-01-06 22:11 UTC
Requires
- php: >=5.4
- guzzlehttp/guzzle: ~4
Requires (Dev)
- mockery/mockery: ~0.9
- phpunit/phpunit: ~4
This package is not auto-updated.
Last update: 2024-12-17 02:59:23 UTC
README
Picnik is a simple PHP client for the Wordnik API, that is Composer and PSR-4 compatible.
Its only dependencies are the GuzzleHttp client and PHP >= 5.4.
API Coverage
The initial goal is to support the word
selection of methods.
Currently, the /word.json/{word}
and /word.json/{word}/definitions
API
methods are implemented.
Usage
In order to use the client, you will first need to obtain an API key from Wordnik.
The client is pretty simple to use,
$client = new Picnik\Client; $client->setApiKey('foobar'); $definitions = $client->wordDefinitions('cat') ->limit(1) ->includeRelated(false) ->useCanonical(true) ->get(); var_dump( count($definitions) ); // int(1) var_dump( $definitions[0]->text ) // string(189) "A small carnivorous mammal (Felis catus or F. domesticus) // domesticated since early times as a catcher of rats and mice and as a pet // and existing in several distinctive breeds and varieties."
License
This library is released under the MIT license. For details, you can refer to the full license document.