承接 luxifer/currency-manager 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

luxifer/currency-manager

最新稳定版本:0.3.0

Composer 安装命令:

composer require luxifer/currency-manager

包简介

Simple, lightweight, currency manager

README 文档

README

This library aims to be a simple lightweight currency manager. It includes a JSON file containing almost every currency definitions. With this libray you can find currency by some field and use the definition in your project. This libray requires jms/serializer to work.

Installation

composer require luxifer/currency-manager

Usage

<?php

require 'vendor/autoload.php';

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

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

Serialization

This library provide a new handler for jms\serializer to handle serialization/deserialization from and to Currency.

<?php

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

You can now use Currency as a Type inside your objects.

<?php
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;
}

Thanks

I would like to tkank @Fluidbyte for the initial currency list published on gist.

统计信息

  • 总下载量: 8.65k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-12-16