astina/money-bundle

该包已弃用,不再维护。未建议替代包。
该包的最新版本(0.1.0)没有可用的许可证信息。

安装: 938

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 19

分支: 0

类型:symfony-bundle

0.1.0 2013-04-29 06:55 UTC

This package is not auto-updated.

Last update: 2023-02-13 05:48:55 UTC


README

99designs/money-php 的 Symfony 包。

添加汇率实体和转换服务。

安装

步骤 1: 添加到 composer.json

"require":  {
    "astina/money-bundle":"dev-master",
}

步骤 2: 启用包

在内核中启用包

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Astina\Bundle\MoneyBundle\AstinaMoneyBundle(),
    );
}

##使用

注意*: 需要为所需的交易所创建 CurrencyExchangeRate 实体。

$moneyChf = new Money\Money(190, 'CHF');

$moneyConverter = $container->get('astina_money.money_converter');
$moneyEur = $moneyConverter->convert($money, 'EUR');