All Projects → gocanto → converter

gocanto / converter

Licence: MIT License
Immutable PHP currency converter that's data-agnostic.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to converter

currency-converter
💰 Easily convert between 32 currencies
Stars: ✭ 16 (-79.22%)
Mutual labels:  converter, currencies
save-file-converter
Converter for retro console save files found around the Internet. All common formats for NES/SNES/GBA/N64/TG16/SMS/Genesis/Neo Geo/PS1 supported. Decrypts PSP saves. Converts to and from Retron 5 and MiSTer
Stars: ✭ 56 (-27.27%)
Mutual labels:  converter
wasm2kt
Web Assembly to Kotlin and Java converter. Allows to compile a C or C++ program/library, and generate a Kotlin or Java program/library.
Stars: ✭ 20 (-74.03%)
Mutual labels:  converter
hooks4git
Extensible Hook Management System for GIT
Stars: ✭ 27 (-64.94%)
Mutual labels:  agnostic
myConsole
基于 TS + React + Mobx 实现的移动端浏览器控制台开发教程
Stars: ✭ 26 (-66.23%)
Mutual labels:  immutable
open money tracker
Open Source accounting application for Android.
Stars: ✭ 19 (-75.32%)
Mutual labels:  currencies
mous
Lightweight audio player & converter for FreeBSD/Linux/macOS
Stars: ✭ 65 (-15.58%)
Mutual labels:  converter
KoHighlights
KOHighlights is a utility for viewing KOReader's highlights and/or export them to simple text, csv or html files.
Stars: ✭ 62 (-19.48%)
Mutual labels:  converter
URTube
URTube, a YouTube video to MP3 downloader built in NodeJs and Electron
Stars: ✭ 20 (-74.03%)
Mutual labels:  converter
dftools
Tools for Star Wars: Dark Forces assets.
Stars: ✭ 18 (-76.62%)
Mutual labels:  converter
entium
A helper for converting entwine tile data into cesium tiles
Stars: ✭ 21 (-72.73%)
Mutual labels:  converter
json2xml
json to xml converter in python3
Stars: ✭ 76 (-1.3%)
Mutual labels:  converter
fermor
Fast, powerful, general-purpose graph traversal and modelling tools plus a performant immutable in-memory graph database.
Stars: ✭ 22 (-71.43%)
Mutual labels:  immutable
gb-convert
Gameboy tile conversion and map editor tool
Stars: ✭ 26 (-66.23%)
Mutual labels:  converter
mysql2sqlite
Online MySQL to SQLite converter 🔨 https://ww9.github.io/mysql2sqlite/
Stars: ✭ 27 (-64.94%)
Mutual labels:  converter
pytorch2keras
PyTorch to Keras model convertor
Stars: ✭ 788 (+923.38%)
Mutual labels:  converter
behave2cucumber
Behave to Cucumber converter
Stars: ✭ 21 (-72.73%)
Mutual labels:  converter
tex-equation-to-svg
Convert a TeX or LaTeX string to an SVG.
Stars: ✭ 34 (-55.84%)
Mutual labels:  converter
GameExtractor
Reads and writes thousands of different archive and image formats used in games.
Stars: ✭ 25 (-67.53%)
Mutual labels:  converter
quill-markdown-toolbar
A Quill.js module for converting markdown text to rich text format
Stars: ✭ 13 (-83.12%)
Mutual labels:  converter

About it

Total Downloads Latest Stable Version Build status

The converter library is a immutable drop in currencies converter that's data-agnostic..

In order for it to work, you will have to pass your repository data look up to pull in a valid information to operate on. This repository has to implement the interface CurrenciesRepositoryInterface shipped with the library

Installation

This library uses Composer to manage its dependencies. So, before using it, make sure you have it installed in your machine. Once you have done this, you will be able to pull this library in by typing the following command in your terminal.

composer require gocanto/converter

Data layer implementation

First of all, you will have to create a repository to query either your database or any other data resources where you keep your application currencies information. see example

Second of all, you will have to new up the converter passing an instance of the mentioned interface repository implementation. Like so:

use Gocanto\Converter\Examples\CurrenciesRepositoryExample;
use Gocanto\Converter\Converter;

$repository = new CurrenciesRepositoryExample;
$converter = new Converter($repository);

Note: You can bind this interface within your app service container to have automatic dependencies injection resolution.

Lastly, you just need to invoke the required methods within the converter object to set the proper values for a given currency conversion (currency from, currency to). Like so:

use Gocanto\Converter\RoundedNumber;

$conversion = $converter
    ->withAmount(RoundedNumber::make(10))
    ->withCurrency('SGD')
    ->convertTo('USD');

This operation will return a Currency Conversion object that holds all the related operations info

Contributing

Please feel free to fork this package and contribute by submitting a pull request to enhance its functionalities.

License

The MIT License (MIT). Please see License File for more information.

How can I thank you?

Why not star the github repo and share the link for this repository on Twitter?

Don't forget to follow me on twitter!

Thanks!

Gustavo Ocanto.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].