burtds/cash-converter
最新稳定版本:v1.0.4
Composer 安装命令:
composer require burtds/cash-converter
包简介
A simple cash converter package for Laravel.
README 文档
README
About cash-converter
A small and simple package that takes away the pain of communicating with ExchangeRate-API directly to convert a certain amount of money between 2 currencies. You can also get the conversion rate or an array with all known conversion rates based on a certain currency.
How to use cash-converter
Installation
Install the package via composer:
composer require burtds/cash-converter
Afterwards, publish the service provider.
php artisan vendor:publish --provider="Burtds\CashConverter\CashConverterProvider"
Usage
First of all add the API key of the ExchangeRate-API service to your .env file of your project.
If you don't have an ExchangeRate-API account yet, create one at exchangerate-api.com.
Once you have an account you can copy your API key from the dashboard page and put it into your .env file.
EXCHANGE_RATE_API_KEY="YOUR-API-KEY"
To use it, import the Facade of this package at the top of your file.
use Burtds\CashConverter\Facades\CashConverter;
Once that is done, you can use the conversion functions.
CashConverter::getRates('EUR'); // returns an array of the currenct conversion rates based on the given currency, in this case Euro CashConverter::getRate('EUR','USD'); // returns the current conversion rate for Euro to US Dollars CashConverter::convert('EUR','USD', 25); // returns the converted vanlue in US Dollars for the given 25 Euro
Test & Format
To execute the tests, run:
composer test
To format the code using pint, run:
composer format
Security Vulnerabilities
If you discover a security vulnerability within this package, please send me an email via bert@bert.gent. I'll get back to you as soon as possible.
Credits
And a huge thanks to Freek Van der Herten for the guidance.
License
This package is open-sourced software licensed under the MIT license.
统计信息
- 总下载量: 81
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 16
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-10-21