PHP code example of vkollin / trefle-php-client

1. Go to this page and download the library: Download vkollin/trefle-php-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/ */

    

vkollin / trefle-php-client example snippets


$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();
bash
composer