laravel-currency
laravel-currency copied to clipboard
Implement 4 sources of exchange rates, contract and manager
- Implementing source contract and 4 sources:
- https://exchangeratesapi.io
- https://openexchangerates.org
- https://currencylayer.com
- https://fixer.io
-
Adding clear exceptions
-
Adding env variables to config file
-
Switching from option to --source argument in Update command
php artisan currency:update --source=fixer
-
Adding Manager and Facade
-
Adding possibility to update exchange rates from everywhere
use Torann\Currency\Facades\SourceManager;
// Option 1
SourceManager::fetchFrom('fixer')->update();
// Option 2
SourceManager::source('fixer')->update();
// Option 2
$manager = app(\Torann\Currency\SourceManager::class);
$manager->fetchFrom(CustomImplementationOfSourceContract::class);
$manager->update();
// Option 4
SourceManager::extend('customApiService', function () {
return new CustomApiService;
});
SourceManager::fetchFrom('customApiService')->update();
@Torann take a look please
This looks great! There's a lot here so I'm going to have to pull it down and play with it some before I approve.
Ok, will waiting for your answer!
Hey @Torann!
I just committed some changes to make the code a bit easier to read. Still waiting for you answer :)
Btw to see the difference, it's better to choose "Hide whitespace changes" in "Files changed" tab.
Is this ready to be merged?
In my opinion - yes, it is. But @Torann should make code review.
Let's hope he takes care of it soon then
At a glance there is a lot going on here. I will need to sit down and make sure this doesn't affect current installs of the package (backwards compatible), if it does we will need an upgrade doc and it will be given a new version. Great work!
Any news here?
There is a lot of changes here. I will need to sit down and test them all before I merge. The quick once over I did of the code though looks great!
@semyonchetvertnyh Семьон, have you considered releasing own version? I really would like to use this patched version but it's not possible unless it's either merged or released as another package.
@klimenttoshkov I don't have plans to create and maintain my own version of the package. If you want to use a patched version, you could fork this branch and use directly in your project.
Just add in your composer.json a path to your GitHub repository:
"require": {
"torann/currency": "dev-master",
},
"repositories": [
{
"url": "https://github.com/klimenttoshkov/laravel-currency.git",
"type": "git"
}
]
Already did that, thank you for the advice! — Kliment Toshkov [email protected]
On 15 May 2020, at 18:27, Semyon Chetvertnyh [email protected] wrote:
@klimenttoshkov https://github.com/klimenttoshkov I don't have plans to create and maintain my own version of the package. If you want to use a patched version, you could fork this branch and use directly in your project.
Just add in your composer.json a path to your GitHub repository:
"require": { "torann/currency": "dev-master", }, "repositories": [ { "url": "https://github.com/klimenttoshkov/laravel-currency.git", "type": "git" } ]— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Torann/laravel-currency/pull/114#issuecomment-629307962, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOIQGVJSNH62X4YGNC6TJ6DRRVNMLANCNFSM4GJHUVTQ.
@Torann any update on this please
@semyonchetvertnyh can you please help with this issue on Laravel 8:
Undefined property: Torann\Currency\SourceManager::$app
Thank you!
@klimenttoshkov I guess property $app was renamed to $container in abstract Manager class of Laravel 8.
Just change $this->app to $this->container in your SourceManager class. It should help.