PHP code example of luxifer / currency-manager

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

    

luxifer / currency-manager example snippets




alizer = JMS\Serializer\SerializerBuilder::create()->build();
$manager = new Luxifer\Manager\CurrencyManager($serializer);

$euro = $manager->getCurrencyBy('code', 'EUR'); // Luxifer\Model\Currency



$serializer->configureHandlers(function(JMS\Serializer\Handler\HandlerRegistry $registry) use ($manager) {
    $registry->registerSubscribingHandler(new Luxifer\Handler\CurrencyHandler($manager));
});


use JMS\Serializer\Annotation\Type;

class MyObject
{
    /**
     * @Type("Currency")
     *
     * will serialize to the currency ISO code
     */
    protected $currency;

    /**
     * @Type("Currency<'symbol'>")
     *
     * will serialize to the currency symbol
     */
    protected $symbol;
}