Download the PHP package ez-laravel/currencies without Composer
On this page you can find all versions of the php package ez-laravel/currencies. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ez-laravel/currencies
More information about ez-laravel/currencies
Files in ez-laravel/currencies
Package currencies
Short Description Easy Laravel Currencies & Convertion
License MIT
Informations about the package currencies
EZ Laravel Currencies
This package provides your application with the functionality to use currencies and easily retrieve conversion rates and apply them to prices.
It makes use of external API's, some of which require an API key. You'll find more details in the instructions below.
Installation
Run the following command in your project directory to install the package:
Publish the migrations and seeds using the following command:
Run the migrations with:
Update your DatabaseSeeder.php
class to load the new seeder and afterwards run the following commands to seed your database:
Run the following command to (optionally) publish the package's config file:
Configuration
Default currency
The default currency is set to EUR, which you can change by adding the following key to your .env
file with the desired currency code:
Currency Conversion Rate API
The following APIs are supported or under development to be supported:
- [x] Fixer.io
- [x] Ratesapi.io
- [x] Frankfurter.app
- [x] Exchangeratesapi.io
You can change the drive the package will use by adding the following key to your .env
file:
Fixer
fixer
Get an API key from the fixer.io website and add it to your .env
file:
RatesAPI
rates
The ratesapi.io website does not require an API key!
Frankfurter
frankfurter
The frankfurter.app website does not require an API key!
ExchangeRatesAPI
exchangerates
The exchangeratesapi.io website does not require an API key!
Usage
Available methods
Updating conversion rates
When you've just installed the package you should perform the following command to manually update all of your currencies conversion rates:
To keep the conversion rates up-to-date automatically schedule the above command to be ran every day (or at whatever interval you'd like) by updating your app/Console/Kernel.php
file to include the following:
More information on task scheduling can be found here.
Extending the Currency model
In most applications you will want to create relationships between the Currency model and for example a Product model or Order model. To do this simply create your own Currency model which extends the EZ\Currencies\Models\Currency
model and update the model path in the currencies.php
config file.
So for example:
And in currencies.php
Contributing
If you'd like to contribute feel free to submit a PR request with your driver(s) or other improvements! Any other feedback is
All versions of currencies with dependencies
illuminate/support Version ^7.0
ez-laravel/model-services Version ^1.0