Code Monkey home page Code Monkey logo

laravel-exchange-rates's Introduction

Ash Allen - Laravel web developer

Hey, I'm Ash Allen! ๐Ÿ‘‹

I'm a freelance Laravel web developer from Preston, UK

  • ๐Ÿ’ฅ I build systems and websites for small businesses using Laravel.
  • ๐Ÿ“š I have a blog that focuses on helping other developers learn more about Laravel, PHP and web development.
  • ๐Ÿ–ฅ I have contributed to Laravel and other open-source projects.
  • ๐ŸŽ‰ I currently have 5 Laravel packages that are being used in commercial systems.
  • โœ๏ธ I write about Laravel, PHP and other web developments topics on the Ash Allen Design blog.
  • โœจ I wrote the FREE 70-page ebook called The Clean Coder's Guide to Laravel.
  • โšก I'm open to collaborating on other Laravel projects.
  • ๐Ÿฅ… 2022 Goal: Contribute to more open-source projects and write a new e-book.

I Write Guest Blog Posts

I Was Featured on Laravel News!

Languages and Tools

Laravel

Vue JS

HTML5

CSS3

Sass

JavaScript

SQL

MySQL

Git




โšก My Open Source Projects


๐Ÿ“˜ Some of My Blog Posts


codeSTACKr's Github Stats

laravel-exchange-rates's People

Contributors

a-lawrence avatar ash-jc-allen avatar dependabot-preview[bot] avatar jlevers avatar ktovergara avatar martyn-v avatar neochief avatar pointybeard avatar ragulka avatar riaanlom avatar stylecibot avatar thugic avatar viicslen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel-exchange-rates's Issues

How to add Local Currency

Hi

I want to add this package to one of my project but I can able to add Pkr as currency. Pkr is Pakistani currency.

Regards

Installation Failed (Guzzle version Issue)

While installing the package, in my local as well as over the server I am facing this issue of Guzzle.

After firing this composer require ashallendesign/laravel-exchange-rates
Below is the output I am getting.

I have tried to change the Guzzle package too but it was not help full
Problem 1 - Installation request for ashallendesign/laravel-exchange-rates ^3.0 -> satisfiable by ashallendesign/laravel-exchange-rates[v3.0.0]. - Conclusion: remove guzzlehttp/guzzle 7.0.1 - Conclusion: don't install guzzlehttp/guzzle 7.0.1 - ashallendesign/laravel-exchange-rates v3.0.0 requires guzzlehttp/guzzle ^6.3 -> satisfiable by guzzlehttp/guzzle[6.3.0, 6.3.1, 6.3.2, 6.3.3, 6.4.0, 6.4.1, 6.5.0, 6.5.1, 6.5.2, 6.5.3, 6.5.4, 6.5.5, 6.5.x-dev]. - Can only install one of: guzzlehttp/guzzle[6.3.0, 7.0.1]. - Can only install one of: guzzlehttp/guzzle[6.3.1, 7.0.1]. - Can only install one of: guzzlehttp/guzzle[6.3.2, 7.0.1]. - Can only install one of: guzzlehttp/guzzle[6.3.3, 7.0.1]. - Can only install one of: guzzlehttp/guzzle[6.4.0, 7.0.1]. - Can only install one of: guzzlehttp/guzzle[6.4.1, 7.0.1]. - Can only install one of: guzzlehttp/guzzle[6.5.0, 7.0.1]. - Can only install one of: guzzlehttp/guzzle[6.5.1, 7.0.1]. - Can only install one of: guzzlehttp/guzzle[6.5.2, 7.0.1]. - Can only install one of: guzzlehttp/guzzle[6.5.3, 7.0.1]. - Can only install one of: guzzlehttp/guzzle[6.5.4, 7.0.1]. - Can only install one of: guzzlehttp/guzzle[6.5.5, 7.0.1]. - Can only install one of: guzzlehttp/guzzle[6.5.x-dev, 7.0.1]. - Installation request for guzzlehttp/guzzle (locked at 7.0.1) -> satisfiable by guzzlehttp/guzzle[7.0.1].

This is the screenshot - https://prnt.sc/u6mqh1

Format converted values

At the moment, the converted values are returned in their lowest currency denomination (e.g. ยฃ1 = 100p therefore its returned as 100).

It might be useful to add a formatter of some sort to the package that can be used to convert the value to something a bit more human-readable. Or at the very least, add something to the docs about how someone could it using an existing method or formatter.

You have not specified a Time-Frame

exchangeRateBetweenDateRange does not conform to their API.

makeRequestForExchangeRates should be updated to start_date and end_date

$result = $this->requestBuilder->makeRequest('/timeseries', [ 'base' => $from, 'start_at' => $date->format('Y-m-d'), 'end_at' => $endDate->format('Y-m-d'), 'symbols' => $symbols, ]);

ArgumentCountError

Hi,

Noticed you now allow different drivers, which is great, so I've dropped my fork and reinstalled this repo, however I'm receiving an 'ArgumentCountError' error when using it.

Too few arguments to function Illuminate\Support\Manager::__construct(), 0 passed in XXX on line Y and exactly 1 expected

It has been a long day, but I don't think I'm missing anything silly.

'driver' => 'exchange-rates-data-api',
'api_key' => env('EXCHANGE_RATES_API_KEY'),
EXCHANGE_RATES_API_KEY=<apikey>

Improve date validation

The Exchange Rates API can only provide exchange rates going back as far as 1999. At the moment, the validation only checks that the date is in the past. An extra validation check could be added to check that the date isn't before 1999.

base_currency_access_restricted

For a free plan, exchangeRate() function working for base currency EUR, Not working for other currencies, When attempting to set other currencies as the base currency issue occurring base_currency_access_restricted
Screenshot 2021-04-05 at 10 57 26 AM

Do not cache

At the moment, we force all exchange rates that are fetched to be stored in the cache before we return them. This could be an optional feature.

This feature could be added as either an optional parameter for each of the methods that it affects, or it could be added as a new chained method (e.g. - ...->doNotCache()->...).

Undefined index: rates exception caused by missing_access_key API error

I am getting an exception:
Undefined index: rates

image

When looking further I see that the API is returning an error.

dd($this->requestBuilder->makeRequest($url, $queryParams));

Results in
image

I requested an access key from exchangeratesapi.io, but currently there is no way of providing an access key to this package

Get the exchange rate for multiple currencies at once

At the moment if you want to get the exchange for multiple currencies, you'd have to make multiple method calls. As an example, to get the exchange rates for EUR to GBP and EUR to USD, you'd have to do the following:

$eurExchangeRate = $exchangeRates->exchangeRate('GBP', 'EUR');
$usdExchangeRate = $exchangeRates->exchangeRate('GBP', 'USD');

This could be updated so that the second parameter accepts an array of currencies. By doing this, we can then return the multiple exchange rates at once. We might be able to do all this under-the-hood by making just one call to the API; otherwise we'll have to make multiple calls and build up the array ourselves.

Potential example of proposed change:

$eurUsdExchangeRate = $exchangeRates->exchangeRate('GBP', ['EUR', 'USD']);

// $eurUsdExchangeRate would be equal to:
[
    'EUR' => 11111,
    'USD' => 22222,
]

ExchangeRateHost Driver now needs an API key

Hello!

The driver https://api.exchangerate.host/ now requires an API key. Using the said driver will now return an error:

{
  "success": false,
  "error": {
    "code": 101,
    "type": "missing_access_key",
    "info": "You have not supplied an API Access Key. [Required format: access_key=YOUR_ACCESS_KEY]"
  }
}

e.g. https://api.exchangeratesapi.io/history?base=GBP&symbols=USD


Additionally, it looks like the endpoint has now different paths and parameters according to their documentation. This makes the class SharedDriverLogicHandler incompatible anymore.

Is it possible to creare a failover with this package ?

hi,

so the config implies i have to choose a specific provider/driver.
but a package that supports multiple providers is predestined to make use of a "failover".
so when this package supports 3 providers, I would expect to have a config like:

return [
   'driver' => 'provider1',
   'faileover' => ['provider2','provider3']
];

so when fetching exchange rates from provider1 failed, the package should try to fetch the data from the "failovers" in exactly that order.

but my question is more general: is it possible to set the provider/driver by code at the current state of this package ?

thanks !

API Error

Hello, When trying to get the output it gives me this api error

Client error: GET http://api.exchangeratesapi.io/v1//latest?access_key=%7Bce7e75f2bbb3079c0aeeca8bb64816e5%7D&base=USD&symbols=SAR resulted in a 401 Unauthorized response: {"error":{"code":"invalid_access_key","message":"You have not supplied a valid API Access Key. [Technical Support: suppo (truncated...) (View: /home/user/website.com/resources/views/home.blade.php) .

I wrote the API correctly from exchangeratesapi.io, And for implementation I just Added this code to .env folder
EXCHANGE_RATES_API_KEY={my-api}

New Exchange Rates API

Hi,

Discussions aren't enabled for this repo, so made an issue. With the breaking change to the exchangerates.io site, and the requirement of a paid plan to set the base rate to something other than EUR etc., there is an alternative API that I found here - exchangerate.host

The base rates endpoint looks to be the same, and returns more currencies. However the historical endpoint is different (from my initial looks the other day).

If I get some time I will write up a PR unless you, or somebody else, beats me to it. But it's certainly something to look into. Possibly as an option, so users can still use the existing exchangerates.io with a free/paid plan.

Invalid conversion for Float values

When I'm trying to convert (using the Convert method) float values e.g.: '0.99' or '2.99' it converts the number to Integer and therefore returns an invalid value. For example, it returns 0 if you want to convert '0.99'.

convert() method does not calculate accurately

When you try to convert a float value (say 42.65), the calculation is not correct, because the input $value is cast to int instead of float in "ExchangeRate" class at line 242:

public function convert(int $value, string $from, $to, Carbon $date = null)

Automatic cache clearing / choosing the cache store

Great package Ash! Iโ€™ve got an app with multiple cache stores. Is there any way to specify which store the package should use?

Also, is there an easy way to clear all cached rates? Iโ€™m not using historical rates (just daily rates). I need to get / use the latest rates each day.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.