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
390 stars 138 forks source link

Call for Opinion: Method that only returns currency symbol #141

Open izshreyansh opened 3 years ago

izshreyansh commented 3 years ago

I'm planning to send a PR that will return currency symbol.

Possible client code might look like this:

currency()->getCurrencySymbol() which outputs one of the relevant currency symbol like: $, .

I came across this idea while using bootstrap form method to place a prepend on input.

<div class="input-group mb-3">
  <div class="input-group-prepend">
    <span class="input-group-text">$</span>
  </div>
  <input type="number" class="form-control" placeholder="Price" aria-label="Price">
</div>
MuluhGodson commented 3 years ago

Great idea, I thought about that today but I'm using Tailwind.

opeless commented 3 years ago

I was looking today for this exact option (I'm trying to format input boxes so I only need the symbol, not the currency amount. A PR would be much appreciated!

ArtMin96 commented 8 months ago
function getCurrencySymbol(): ?string
{
    return currency()->find(currency()->getUserCurrency())['symbol'];
}