vkollin / trefle-php-client
Trefle API client
v0.1.0
2023-04-23 11:49 UTC
Requires
- php: >=8.1
- guzzlehttp/guzzle: ^7.5
Requires (Dev)
- phpunit/phpunit: ^10.1
- slevomat/coding-standard: ^8.11
- squizlabs/php_codesniffer: ^3.7
- vimeo/psalm: ^5.9
README
This is a client for trefle.io.
Installation
composer require vkollin/trefle-php-client
Usage
$trefleClient = TrefleClient::create('your-token'); // get a specific species $sunflowerSpecies = $trefleClient->getSpecies('helianthus-annuus')->getSpecies(); // get a specific plant $sunflowerPlant = $trefleClient->getPlant('helianthus-annuus')->getPlant(); // search for species matching a query $searchRequest = (new SearchRequest())->setQuery('oak')->setLimit(5); $searchResults = $trefleClient->searchSpecies($searchRequest)->getSpecies();
Implemented endpoints
Species
- List species
- Retrieve a species
- Search for species (only query parameters and limit is implemented at the moment, but no filters)
- Report an error
Plants
- List plants
- Retrieve a plant
- Search for a plant
- Report an error
- List plants in a distribution zone
- List plants of a genus