PHP code example of lukaszwit / currency

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

    

lukaszwit / currency example snippets



use Currency\Eur;

$eur = new Eur;
$eur = '10'; // this is OK

$eur = 10; // but this emits UnexpectedValueException



use Currency\Usd;
use Currency\AbstractCurrency as Currency;

class Example
{
    public function workWithCurrency(Currency $c)
    {

    }

    public function workOnlyWithUsd(Usd $usd)
    {

    }
}