Torann / laravel-currency

This provides Laravel with currency functions such as currency formatting and conversion using up-to-date exchange rates.
http://lyften.com/projects/laravel-currency
BSD 2-Clause "Simplified" License
392 stars 137 forks source link

How can i get all available currencies ? #28

Closed mogahead closed 8 years ago

mogahead commented 9 years ago

I need to view all available currencies , how can i do that ?

simplenotezy commented 9 years ago

Agreed. Package should include all currencies by default.

Should follow iso4217: http://www.xe.com/iso4217.php

hgeorgilas commented 8 years ago

You could try \DB::table('currency')->get() to get all curencies it actually depends on your configuration though, how you have named your currency table

Torann commented 8 years ago

Version 0.2 now comes with a helper function currency()

To get all currencies:

currency()->setCacheCurrencies();

This will return an array of all currencies:

[
  "USD" => [
    "id" => 1
    "title" => "U.S. Dollar"
    "symbol_left" => "$"
    "symbol_right" => ""
    "decimal_place" => 2
    "value" => 1.0
    "decimal_point" => "."
    "thousand_point" => ","
    "code" => "USD"
  ]
  "EUR" => [
    "id" => 2
    "title" => "Euro"
    "symbol_left" => "€"
    "symbol_right" => ""
    "decimal_place" => 2
    "value" => 0.8912
    "decimal_point" => "."
    "thousand_point" => ","
    "code" => "EUR"
  ]
]