Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement 4 sources of exchange rates, contract and manager #114

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Implement 4 sources of exchange rates, contract and manager #114

wants to merge 8 commits into from

Conversation

semyonchetvertnyh
Copy link

@semyonchetvertnyh semyonchetvertnyh commented Dec 9, 2018

  • Implementing source contract and 4 sources:
  1. https://exchangeratesapi.io
  2. https://openexchangerates.org
  3. https://currencylayer.com
  4. 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();

4 sources: currencylayer.com, exchangeratesapi.io, fixer.io, openexchangerates.org;
Add Exceptions
@semyonchetvertnyh semyonchetvertnyh changed the title Implement 4 sources, contract and manager Implement 4 sources of exchange rate, contract and manager Dec 9, 2018
@semyonchetvertnyh semyonchetvertnyh changed the title Implement 4 sources of exchange rate, contract and manager Implement 4 sources of exchange rates, contract and manager Dec 9, 2018
@semyonchetvertnyh
Copy link
Author

@Torann take a look please

@Torann
Copy link
Owner

Torann commented Dec 12, 2018

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.

@semyonchetvertnyh
Copy link
Author

Ok, will waiting for your answer!

@semyonchetvertnyh
Copy link
Author

semyonchetvertnyh commented Mar 14, 2019

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.

@f-liva
Copy link

f-liva commented Jun 18, 2019

Is this ready to be merged?

@semyonchetvertnyh
Copy link
Author

In my opinion - yes, it is. But @Torann should make code review.

@f-liva
Copy link

f-liva commented Jun 20, 2019

Let's hope he takes care of it soon then

@Torann
Copy link
Owner

Torann commented Jun 21, 2019

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!

@f-liva
Copy link

f-liva commented Sep 3, 2019

Any news here?

@Torann
Copy link
Owner

Torann commented Sep 4, 2019

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!

@klimenttoshkov
Copy link

@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.

@semyonchetvertnyh
Copy link
Author

@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"
        }
    ]

@klimenttoshkov
Copy link

klimenttoshkov commented May 15, 2020 via email

@tariqdev
Copy link

tariqdev commented Sep 7, 2020

@Torann any update on this please

@klimenttoshkov
Copy link

@semyonchetvertnyh can you please help with this issue on Laravel 8:

Undefined property: Torann\Currency\SourceManager::$app

Thank you!

@semyonchetvertnyh
Copy link
Author

semyonchetvertnyh commented Jan 30, 2021

@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.

@dcyou dcyou mentioned this pull request Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants