brightcreations/money-converter 问题修复 & 功能扩展

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

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

brightcreations/money-converter

最新稳定版本:v0.1.2

Composer 安装命令:

composer require brightcreations/money-converter

包简介

A Laravel package for converting currencies using exchange rates.

README 文档

README

A PHP package for converting money between different currencies.

Downloads License Last Commit Stars

Overview

This package provides a simple and efficient way to convert money between different currencies. It uses a unified interface to fetch exchange rates and perform conversions, making it easy to integrate with various exchange rate services.

Features

  • Converts money between different currencies
  • Uses a unified interface to fetch exchange rates and perform conversions
  • Supports multiple exchange rate services
  • Throws exceptions for invalid conversions or missing exchange rates
  • Easy to integrate with various frameworks and applications

Installation

To install the Exchange Rates Service package, run the following command in your terminal:

composer require brightcreations/money-converter

Configuration

To configure the package, publish the configuration file using the following command:

php artisan vendor:publish --provider="BrightCreations\MoneyConverter\MoneyConverterServiceProvider"

Then, update the money-converter.php configuration file to suit your needs.

Usage

To retrieve exchange rates, use the MoneyConverterInterface:

use BrightCreations\MoneyConverter\Contracts\MoneyConverterInterface;

// Converts 100.00 USD to EUR using the current exchange rate
$convertedMinorInt = $service->convert(10000, 'USD', 'EUR');

// Converts 100.00 USD to EUR using the exchange rate of a previous date
$convertedMinorInt = $service->convert(10000, 'USD', 'EUR', now()->subDays(1));

Important Note: Before using the package, make sure that the tables of the exchange rates are in your database and the names of the tables and columns are reflected in the config as it is.

You can inject the service into a constructor or resolve it using the resolve or app->make method. Here are examples of each approach:

Constructor Injection

use BrightCreations\MoneyConverter\Contracts\MoneyConverterInterface;

class SomeClass {
    private $service;

    public function __construct(MoneyConverterInterface $service) {
        $this->service = $service;
    }

    public function someMethod() {
        $convertedMinorInt = $this->service->convert(10000, 'USD', 'EUR');
    }
}

Using resolve Method

use BrightCreations\MoneyConverter\Contracts\MoneyConverterInterface;

$service = resolve(MoneyConverterInterface::class);
$convertedMinorInt = $service->convert(10000, 'USD', 'EUR');

Using app->make Method

use BrightCreations\MoneyConverter\Contracts\MoneyConverterInterface;

$service = app()->make(MoneyConverterInterface::class);
$convertedMinorInt = $service->convert(10000, 'USD', 'EUR');

API Documentation

Coming soon...

Contributing

Contributions are welcome! Please submit a pull request or open an issue to report any bugs or suggest new features.

License

This package is licensed under the MIT License.

Author

Kareem Mohamed - Bright Creations Email: kareem.shaaban@brightcreations.com

Version

0.1.2

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固