Number helper #42941
-
Hi guys! I came from CakePHP and there I was since from CakePHP 2.x. One of the things that I used everyday on cake was the Number helper. It's very useful to format currency, percentages, float numbers, prefixed and postfixed cases and other things. I don't know if I just not found it on Laravel, or if it doesn't exist, but I think that this will be a big improvement on the framework core. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 4 replies
-
There is no such helper in Laravel, but number formatting is built-in into PHP: |
Beta Was this translation helpful? Give feedback.
-
https://github.com/cakephp/cakephp/blob/4.x/src/I18n/Number.php It's a lot of possibilities that this helper can do in the context of "numbers". |
Beta Was this translation helpful? Give feedback.
-
I found the document. |
Beta Was this translation helpful? Give feedback.
-
Not strictly necessary but I do see your point compared to the bloated |
Beta Was this translation helpful? Give feedback.
-
In my opinion, the introduction of the Furthermore, even experienced developers may not be entirely familiar with the The availability of the Personally, I'm excited about this idea and believe it will bring substantial benefits to the Laravel community. |
Beta Was this translation helpful? Give feedback.
In my opinion, the introduction of the
number
helper represents an advance for the Laravel community, especially having a part of the documentation that talks about formatting numbers, decimals and monetary values. This will simplify implementation, especially for less experienced developers, by formatting float values for your country's currency.Furthermore, even experienced developers may not be entirely familiar with the
NumberFormatter
, and the need to instantiate an object for formatting can make the code more extensive. The inclusion of this helper eliminates the need for developers to create their own formatting classes or install third-party packages for this purpose.The availab…