Skip to content

Latest commit

 

History

History
51 lines (34 loc) · 1.3 KB

README.md

File metadata and controls

51 lines (34 loc) · 1.3 KB

💲 Currencies

Along with Money, as you have already noticed, Currencies are also provided. In many methods you have to pass a Currency object.

In order to get a specific currency:

use PostScripton\Money\Currency;

$usd = Currency::code('USD');
$usd = Currency::code('usd');
$usd = Currency::code('840');

$usd = currency('USD');
$usd = currency('usd');
$usd = currency('840');

❗ Only international codes such as USD / 840, EUR / 978, RUB / 643 and so on should be used as a code. (And your own currencies' codes 😉)

Global settings

Remember that all the settings, which are applied to a currency will be saved for the next times.

use PostScripton\Money\CurrencyDisplay;

$usd = currency('usd');
$usd->setDisplay(CurrencyDisplay::Code);

$usd = currency('usd');
$usd->getDisplay(); // CurrencyDisplay::Code

Currency's data

You can also get or change some data from Currency object:

  1. Default currency
  2. Information
  3. Position
  4. Display
  5. Preferred symbol
  6. Collection methods

📌 Back to the contents.