DEV Community

Cover image for [Package] Laravel Currency Formatter
Marc Garcia Torrent
Marc Garcia Torrent

Posted on • Originally published at devdojo.com

[Package] Laravel Currency Formatter

Hello there! Marc here again.

I've just released a new Laravel package, this time it's about currencies. Almost in every project we have to format money in one or more formats, and personally, I've never remember how format with number format and round functions 😅

Easy and tiny package for all of you guys, enjoy it. And always, PRs and suggestions will be welcome!

https://github.com/magarrent/laravel-currency-formatter


Laravel Currency Formatter

Tiny Laravel worldwide currency formatter

Laravel Currency Formatter

Software LicensePackage Size

"Buy Me A Coffee"

Install

composer require magarrent/laravel-currency-formatter

Usage

use Magarrent\LaravelCurrencyFormatter\Facades\Currency

Currency::currency("EUR")->format(256)          // 256,00 €
Currency::currency("EUR")->format(256, true)    // 256 €
Currency::currency("USD")->format(256)          // $256,00
Currency::currency("USD")->format(256, true)    // $256

Currency::currency("GBP")->format(256)          // £256.00
Currency::currency("BTC")->format(256)          // 256.00000000Ƀ

Currency::currency("USD")->format(123456789)    // $123,456,789.00
Currency::currency("EUR")->format(123456789)    // 123.456.789,00 €
Enter fullscreen mode Exit fullscreen mode

Available Currencies:

AED - د.إ.‏
AFN - ؋
ALL - Lek
AMD - ֏
ANG - ƒ
AOA - Kz
ARS - $
AUD - $
AWG - ƒ
AZN - ₼
BAM - КМ
BBD - $
BDT - ৳
BGN - лв.
BHD - د.ب.‏
BIF - FBu
BMD - $
BND - $
BOB - Bs
BRL - R$
BSD - $
BTC - Ƀ
BTN - Nu.
BWP - P
BYR - р.
BYN - р.
BZD - BZ$
CAD - $
CDF - FC
CHF - CHF
CLP - $
CNY - ¥
COP - $
CRC - ₡
CUC - CUC
CUP - $MN
CVE - $
CZK - Kč
DJF - Fdj
DKK - kr.
DOP - RD$
DZD - د.ج.‏
EGP - ج.م.‏
ERN - Nfk
ETB - ETB
EUR - €
FJD - $
FKP - £
GBP - £
GEL - GEL
GHS - ₵
GIP - £
GMD - D
GNF - FG
GTQ - Q
GYD - $
HKD - HK$
HNL - L.
HRK - kn
HTG - G
HUF - Ft
IDR - Rp
ILS - ₪
INR - ₹
IQD - د.ع.‏
IRR - ﷼
ISK - kr.
JMD - J$
JOD - د.ا.‏
JPY - ¥
KES - KSh
KGS - сом
KHR - ៛
KMF - CF
KPW - ₩
KRW - ₩
KWD - د.ك.‏
KYD - $
KZT - ₸
LAK - ₭
LBP - ل.ل.‏
LKR - ₨
LRD - $
LSL - M
LYD - د.ل.‏
MAD - د.م.‏
MDL - lei
MGA - Ar
MKD - ден.
MMK - K
MNT - ₮
MOP - MOP$
MRO - UM
MTL - ₤
MUR - ₨
MVR - MVR
MWK - MK
MXN - $
MYR - RM
MZN - MT
NAD - $
NGN - ₦
NIO - C$
NOK - kr
NPR - ₨
NZD - $
OMR - ﷼
PAB - B/.
PEN - S/.
PGK - K
PHP - ₱
PKR - ₨
PLN - zł
PYG - ₲
QAR - ﷼
RON - L
RSD - Дин.
RUB - ₽
RWF - RWF
SAR - ﷼
SBD - $
SCR - ₨
SDD - LSd
SDG - £‏
SEK - kr
SGD - $
SHP - £
SLL - Le
SOS - S
SRD - $
STD - Db
SVC - ₡
SYP - £
SZL - E
THB - ฿
TJS - TJS
TMT - m
TND - د.ت.‏
TOP - T$
TRY - ₺
TTD - TT$
TVD - $
TWD - NT$
TZS - TSh
UAH - ₴
UGX - USh
USD - $
UYU - $U
UZS - сўм
VEB - Bs.
VEF - Bs. F.
VND - ₫
VUV - VT
WST - WS$
XAF - F
XCD - $
XBT - Ƀ
XOF - F
XPF - F
YER - ﷼
ZAR - R
ZMW - ZK
WON - ₩
Enter fullscreen mode Exit fullscreen mode

Contributing

Please see CONTRIBUTING for details.

Credits

Security

If you discover any security-related issues, use the issue tracker.

License

The MIT License (MIT). Please see License File for more information.

Top comments (0)