[Package] Laravel Currency Formatter

[Package] Laravel Currency Formatter

Written by Marc Garcia on Aug 11th, 2021 ・ Views ・ Report Post

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 €

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 - ₩

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.

Comments (0)