定制 extradevs/laravel-mnb 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

extradevs/laravel-mnb

最新稳定版本:v3.0.0

Composer 安装命令:

composer require extradevs/laravel-mnb

包简介

Laravel MNB (Magyar Nemzeti Bank)

README 文档

README

Requirements

Package requires Soap and version 7.1 of PHP or higher.

Know-how

This package was built on top of this MNB package. Please check out for corresponding documentations.

Install

composer require extradevs/laravel-mnb

Configuration

Export

php artisan vendor:publish --provider="SzuniSoft\Mnb\Laravel\MnbServiceProvider" --tag="config"

config/mnb-exchange.php

    /*
     * Wsdl file location.
     * */
    'wsdl' => env('MNB_SOAP_WSDL', 'http://www.mnb.hu/arfolyamok.asmx?wsdl'),

    'cache' => [

        /*
         * Desired cache driver for service.
         * */
        'store' => env('MNB_CACHE_DRIVER', 'file'),

        /*
         * Minutes the cached currencies will be held for.
         * Default: 24hrs (1440)
         * */
        'minutes' => env('MNB_CACHE_MINUTES', 1440),
    ]

Usage

Access via facade

use Extradevs\Mnb\Laravel\Facade\Mnb

$currency = Mnb::currentExchangeRate('EUR');

Resolve by application container

$currency = app(\Extradevs\Mnb\Laravel\Client::class)->currentExchangeRate('EUR');

Access refresh date by reference

You can check the feed date by passing a $date variable to some methods. These methods will make variable to be a Carbon instance.

Mnb::exchangeRates($date);
$date->isToday();

Available methods

Won't use cache

These methods won't use and update cache.

  • currentExchangeRate($code, &$date = null): Currency
  • currentExchangeRates(&$date = null): array of Currency

Will use cache

These methods will use cache.

  • exchangeRate($code, &$date = null): single Currency
  • exchangeRates(&$date = null): array of currencies
  • currencies(): array of strings (each is currency code)
  • hasCurrency($code): bool

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-06-06