flexmind-software/currency-rate
Composer 安装命令:
composer require flexmind-software/currency-rate
包简介
Library download currency rate and save in database, It's designed to be extended by any available data source.
关键字:
README 文档
README
Installation
You can install the package via composer:
composer require flexmind-software/currency-rate
You can publish and run the migrations with:
php artisan vendor:publish --provider="FlexMindSoftware\CurrencyRate\CurrencyRateProvider" --tag="currency-rate-migrations" php artisan migrate
You can publish the config file with:
php artisan vendor:publish --provider="FlexMindSoftware\CurrencyRate\CurrencyRateProvider" --tag="currency-rate-config"
This is the contents of the published config file:
return [ 'driver' => env('FLEXMIND_CURRENCY_RATE_DRIVER', 'european-central-bank'), 'drivers' => [ 'albania', 'armenia', 'australia', 'azerbaijan', 'bceao', 'belarus', 'bosnia-and-herzegovina', 'botswana', 'bulgaria', 'canada', 'china', 'croatia', 'czech-republic', 'denmark', 'england', 'european-central-bank', 'fiji', 'georgia', 'hungary', 'iceland', 'israel', 'macedonia', 'moldavia', 'norway', 'poland', 'romania', 'russia', 'serbia', 'sweden', 'switzerland', 'turkey', 'ukraine', ], 'table-name' => env('FLEXMIND_CURRENCY_RATE_TABLENAME', 'currency_rates'), 'cache-ttl' => env('FLEXMIND_CURRENCY_RATE_CACHE_TTL', 3600), ];
The drivers array defines which currency rate providers are available when running
the command with --driver=all. Add or remove entries from this list to customise
the drivers used in your application. See config/currency-rate.php for additional configuration options, including the cache TTL for HTTP requests.
Available Drivers
| Country / Source | Driver |
|---|---|
| Albania | albania |
| Armenia | armenia |
| Australia | australia |
| Azerbaijan | azerbaijan |
| BCEAO | bceao |
| Belarus | belarus |
| Bosnia and Herzegovina | bosnia-and-herzegovina |
| Botswana | botswana |
| Bulgaria | bulgaria |
| Canada | canada |
| China | china |
| Croatia | croatia |
| Czech Republic | czech-republic |
| Denmark | denmark |
| England | england |
| European Central Bank | european-central-bank |
| Fiji | fiji |
| Georgia | georgia |
| Hungary | hungary |
| Iceland | iceland |
| Israel | israel |
| Macedonia | macedonia |
| Moldavia | moldavia |
| Norway | norway |
| Poland | poland |
| Romania | romania |
| Russia | russia |
| Serbia | serbia |
| Sweden | sweden |
| Switzerland | switzerland |
| Turkey | turkey |
| Ukraine | ukraine |
Usage
php artisan flexmind:currency-rate [options] [--] [<date>] Arguments: date Date to download currency rate, if empty is today Options: --queue[=QUEUE] Queue name, if set "none" cmd run without add job to queue [default: "none"] --driver[=DRIVER] Driver to download rate [default: "all"]
Events
The CurrencyRate::saveIn method dispatches a CurrencyRateSaved event once rates are persisted. Consumers may listen for this event to trigger downstream actions:
use FlexMindSoftware\CurrencyRate\Events\CurrencyRateSaved; use Illuminate\Support\Facades\Event; Event::listen(CurrencyRateSaved::class, function (CurrencyRateSaved $event) { // $event->rates contains the saved records }); ### Examples Run for today's rates using all configured drivers: ```bash php artisan flexmind:currency-rate
Fetch rates for a specific date:
php artisan flexmind:currency-rate 2023-09-15
Use a specific driver:
php artisan flexmind:currency-rate --driver=canada
Dispatch the job to a queue:
php artisan flexmind:currency-rate --queue=default
Execute immediately without queueing:
php artisan flexmind:currency-rate --queue=none
Testing
composer test
Sources
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Adding new locales
Translations for driver descriptions live in resources/langs/{locale}/description.php.
To contribute a new locale:
- Create a new directory for the locale under
resources/langs(for exampleesfor Spanish). - Copy
resources/langs/en/description.phpinto that directory and translate the strings. - Submit a pull request with the new translation file.
Credits
License
The MIT License (MIT). Please see License File for more information.
flexmind-software/currency-rate 适用场景与选型建议
flexmind-software/currency-rate 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15 次下载、GitHub Stars 达 2, 最近一次更新时间为 2021 年 09 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「mysql」 「mongo」 「laravel」 「currency-converter」 「postresql」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 flexmind-software/currency-rate 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 flexmind-software/currency-rate 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 flexmind-software/currency-rate 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dibi is Database Abstraction Library for PHP
MongoDB extension for the Yii framework
PHP module for MySql database
Add beauty to momgodb query arrays.
A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)
VV database abstraction layer with query builder and DB structure models
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-09-14