withfatpanda/numeral-blade

1.0.1 2018-01-22 21:09 UTC

This package is not auto-updated.

Last update: 2024-11-10 05:56:34 UTC


README

This Laravel 5 package adds a blade directive named @numeral, which you can use to process numbers into a variety of formats.

Here's a quick example:

<!-- +10,000 -->
@numeral(10000.23, '+0,0')

<!-- 233.43k -->
@numeral(233434, '0a.00')

This directive is just an alias for stillat/numeral.php by JohnathanKoster, which itself is a port of numeraljs.

It's dependencies all the way down!

Facade

You can also use Numeral via the Numeral facade. Just add it to your aliases list in config/app.php:

'aliases' => [

  'Numeral' => FatPanda\Blade\Numeral\Facade::class

]

Then, you'll be able to invoke Numeral::format($number, $format) anywhere you please.

Contributing

This project is unlikely to get a lot of my focus.

If you find a problem, please fix it and issue a pull request.

Wishlist

I'd love to see someone spend the time to create a configuration file. I don't have time, and probably won't ever need one.