dostrog/larate 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

dostrog/larate

最新稳定版本:v2.0.0

Composer 安装命令:

composer require dostrog/larate

包简介

Small library to access to currency exchange rates API of CBRF (Bank of Russia) and NBU (National Bank of Ukraine) from Laravel

README 文档

README

Latest Version on Packagist GitHub Code Style Action Status Total Downloads

Overview

A simple Laravel package used for interacting with the Bank of Russia and National Bank of Ukraine API. 'Larate' allow you to get the latest or historical converted monetary values between RUB (UAH) and other currencies.

Installation

You can install the package via composer:

composer require dostrog/larate

You can publish the config file with:

php artisan vendor:publish --provider="Dostrog\Larate\Providers\LarateServiceProvider" --tag="config"

This is the contents of the published config file:

return [
    'default_base_currency' => 'RUB',
    'service' => [
        'RUB' => Dostrog\Larate\Services\RussianCentralBank::class,
        'UAH' => Dostrog\Larate\Services\NationalBankOfUkraine::class,
    ],
];

Usage

// instantiate from Laravel IoC for inject provider
// according to config it maybe RUB (converted) rates from Central Bank OF Russia
$provider = app()->make(Larate::class);
$pair = new CurrencyPair('RUB', 'USD');
$date = Carbon::parse('2020-01-16');
$rate = $provider->getExchangeRate($pair, $date);
$value = $rate->getValue(); // 61.4328

// ...or using factory method, i.e. for getting UAH (converted) rates from National Bank of Ukraine
$provider = Larate::createForBaseCurrency('UAH');
$pair = new CurrencyPair('UAH', 'USD');
$date = Carbon::parse('2020-01-16');
$rate = $provider->getExchangeRate($pair, $date);
$value = $rate->getValue(); // 23.9821

// ...or using Laravel's Facades
$rate = LarateFacade::getExchangeRate($pair, $date);
$value = $rate->getValue();

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-02-18