make-it-app / laravel-currency-extractor
A currency extractor for the Laravel
v1.0.1.1
2024-01-19 09:13 UTC
Requires
- php: ^8.1|^8.2|^8.3
- graham-campbell/guzzle-factory: ^3.0|^4.0
- laravel/framework: ^10.10
Requires (Dev)
- laravel/pint: ^1.0
This package is auto-updated.
Last update: 2024-04-19 13:11:11 UTC
README
Installation
composer require make-it-app/laravel-currency-extractor php artisan vendor:publish --provider="MakeIT\LaravelCurrencyExtractor\CurrencyExtractorServiceProvider" --tag="config"
Please observe the config-file first!
If You plan to work with:
- Observers:
php artisan vendor:publish --provider="MakeIT\LaravelCurrencyExtractor\CurrencyExtractorServiceProvider" --tag="observers"
You are free to mod this file after publishing! - Policies:
php artisan vendor:publish --provider="MakeIT\LaravelCurrencyExtractor\CurrencyExtractorServiceProvider" --tag="policies"
You are free to mod this file after publishing! - Laravel Nova:
php artisan vendor:publish --provider="MakeIT\LaravelCurrencyExtractor\CurrencyExtractorServiceProvider" --tag="nova"
Attention, tested only on Nova 4! You are free to mod this file after publishing!
Usage
See src/CurrencyExtractorHelper.php
or
$extractor = CurrencyExtractor::make(); $extractor->fetchAndCache( $key ); return $extractor->getRates();
Or (recommended)
php artisan makeit:currency-extractor:pull
it will pull the exchange rates from external data provider, put it into Cache and create (or update, when exists) a Database records