kowal/module-kursywalutnbp
Composer 安装命令:
composer require kowal/module-kursywalutnbp
包简介
Aktualizacja kursów walut NBP do Magento
README 文档
README
``kowal/module-kursywalutnbp``
Main Functionalities
Aktualizacja kursów walut NBP do Magento
Installation
* = in production please use the --keep-generated option
Type 1: Zip file
- Unzip the zip file in
app/code/Kowal - Enable the module by running
php bin/magento module:enable Kowal_KursyWalutNbp - Apply database updates by running
php bin/magento setup:upgrade* - Flush the cache by running
php bin/magento cache:flush
Type 2: Composer
- Make the module available in a composer repository for example:
- private repository
repo.magento.com - public repository
packagist.org - public github repository as vcs
- private repository
- Add the composer repository to the configuration by running
composer config repositories.repo.magento.com composer https://repo.magento.com/ - Install the module composer by running
composer require kowal/module-kursywalutnbp - enable the module by running
php bin/magento module:enable Kowal_KursyWalutNbp - apply database updates by running
php bin/magento setup:upgrade* - Flush the cache by running
php bin/magento cache:flush
Configuration
Specifications
- Cronjob
- kowal_kursywalutnbp_updatecurrency
Attributes
Usage
Note: currently only average rate is retrieved.
Example: getting the average rate from specific day
$nbp = new NbpRepository();
$currencyData = $nbp->getRate('2015-01-02', 'USD');
var_dump($currencyData->avg);
var_dump($currencyData->date);
Outputs:
double(3.5725)
string(10) "2015-01-02"
Example: getting the average rate from first date before specified date
This is usefull when you need to retrieve last available currency rate from working day before specified date.
$nbp = new NbpRepository();
$currencyData = $nbp->getRateBefore('2015-01-02', 'USD');
var_dump($currencyData->avg);
var_dump($currencyData->date);
Outputs:
double(3.5072)
string(10) "2014-12-31"
Example: using cache
When using cache the amount of HTTP requests to NBP server is minimized.
<?php
use Doctrine\Common\Cache\FilesystemCache;
use MaciejSz\NbpPhp\Service\NbpCache;
use MaciejSz\NbpPhp\NbpRepository;
$cacheBackend = new FilesystemCache(sys_get_temp_dir() . "/nbp-php");
$nbpCache = new NbpCache($cacheBackend);
$nbp = new NbpRepository($nbpCache);
// ...
kowal/module-kursywalutnbp 适用场景与选型建议
kowal/module-kursywalutnbp 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 158 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 12 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 kowal/module-kursywalutnbp 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kowal/module-kursywalutnbp 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 158
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2019-12-03