List currencies
Lists the code and name of all currencies of the company, or those that match a pattern.
currencies()->search() searches them with the Finder (type CUR). count() asks for the number of matches with one small request; all() goes through all pages for you.
Each result is a CurrencySummary with code and name. Use get() for the short name and the exchange rates (see Read currency).
The search is immutable and can be refined further, e.g. search('U*')->inCode(), ->inName() or ->limit(10)->get() for one page. To check one code, use exists('USD').
$twinfield = Example::twinfield();
// A pattern from the command line, e.g. `U*`, or else all currencies.$search = $twinfield->currencies()->search($argv[1] ?? '*');
echo $search->count(), ' currencies', PHP_EOL;
foreach ($search->all() as $currency) { echo $currency->code, ' ', $currency->name, PHP_EOL;}php examples/currencies/list-currencies/example.php3 currenciesEUR EuroGBP Pound sterlingUSD US dollarSource
Section titled “Source”View examples/currencies/list-currencies/example.php on GitHub.
Twinfield and Wolters Kluwer are trademarks of Wolters Kluwer. Their names and logos are used only to refer to their products.