Download the PHP package amkas/currency-converter without Composer
On this page you can find all versions of the php package amkas/currency-converter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download amkas/currency-converter
More information about amkas/currency-converter
Files in amkas/currency-converter
Package currency-converter
Short Description Currency Converter is a simple easy to use package for Laravel for currency conversion.
License MIT
Homepage https://github.com/Ch-Kashif171/currency-converter
Informations about the package currency-converter
Currency Converter
Currency Converter is a simple easy to use package for Laravel for currency conversion.
Getting Started
Install Currency Converter via composer. Note: If you do not have composer yet, you can install it by following the instructions on https://getcomposer.org
Step 1. Install package
composer require amkas/currency-converter
Step 2. Register the Currency Converter service provider (Optional)
in bootstrap/providers.php you can add following line
Step 3. Publish Assets
To publish the assets run the below command.
Or
This command will copy three files as below:
So there are three files
- Currency rates migration
- Currency Rate model
- config/currency-converter.php
After that, you need to run the migration command to migrate the currency rates table into database as below:
Then you can set the default currency in config file as below:
and other config settings.
After that, you can create a CRUD to save the currency rates into database
Usage:
In Controller include Currency Facade and call as below:
If you want to use a helper's function use below.
If you want to convert amount from one currency to another using Currency Facade, call chain functions as below:
with helper functions you can call as below:
Note: Since this currency converter has cache implemented to avoid database query everytime when currency conversion function will call, so every time when new currency rate will add via CurrencyRate model, the cahce will automatically reset.
However, you can reset that specific cache by runing the below command:
``