PHP code example of plantgeekz / botanical-name
1. Go to this page and download the library: Download plantgeekz/botanical-name 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/ */
plantgeekz / botanical-name example snippets
use PlantGeekz\BotanicalName\BotanicalName;
$name = BotanicalName::parse('hydrangea x macrophylla ssp. serrata cv. Bluebird');
$name->toString(); // Hydrangea ×macrophylla subsp. serrata 'Bluebird'
$name->toHtml(); // <i>Hydrangea</i> ×<i>macrophylla</i> subsp. <i>serrata</i> 'Bluebird'
$name->slug(); // hydrangea-macrophylla-subsp-serrata-bluebird
$name->key(); // hydrangea macrophylla subsp. serrata bluebird
$name = BotanicalName::parse("Pinus mugo Turra subsp. uncinata (DC.) Domin");
$name->genus; // "Pinus"
$name->epithet; // "mugo"
$name->authorship; // "Turra"
$name->infraspecific[0]->rank; // "subsp."
$name->infraspecific[0]->epithet; // "uncinata"
$name->infraspecific[0]->authorship; // "(DC.) Domin"
BotanicalName::normalize('PASSIFLORA EDULIS f. flavicarpa O.Deg.');
// "Passiflora edulis f. flavicarpa O.Deg."
$name = BotanicalName::parse("Magnolia grandiflora L. 'Little Gem'");
$name->toString(); // Magnolia grandiflora 'Little Gem'
$name->toString(authors: true); // Magnolia grandiflora L. 'Little Gem'
$name->toString(typographic: true); // Magnolia grandiflora ‘Little Gem’
$name->toHtml(); // <i>Magnolia grandiflora</i> 'Little Gem'
$name->toHtml(authors: true, tag: 'em');
BotanicalName::parse('Hydrangea x macrophylla')->key(); // hydrangea macrophylla
BotanicalName::parse('HYDRANGEA ×MACROPHYLLA')->key(); // hydrangea macrophylla