Recommend this page to a friend! |
![]() ![]() |
Info | ![]() |
![]() ![]() |
Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2024-04-01 (5 days ago) ![]() | Not enough user ratings | Total: 11 This week: 11 | All time: 11,270 This week: 7![]() |
Version | License | PHP version | Categories | |||
laravel-numeral 1.0 | MIT/X Consortium ... | 8.2 | Algorithms, Libraries, Math, PHP 8 |
Description | Author | |
This package can perform operations and format number values. |
|
This package inlines the Number helper with the Str helper. It does so by adding some functionality as well as introducing a number of tools:
This class is the one that should align with the existing Stringable. This wrapper allows chaining operations on numbers. Most of the native operations from PHP have been added, along with other helper functions. Some basic equations like fractals have been also added to this.
It uses the same traits than its sibling Stringable, however it's lacking some interfaces (JsonSerializable, ArrayAccess) as those don't apply to this scalar. PHP's \Stringable (not to be confused with Illuminate\Support\Stringable) is implemented in order to cast the value to a string and allow visual representation in Blade (this is done with the existing Number's method format().
The decision of using this name instead of Numerable to fully align it with Stringable is due to the definition provided by Oxford's dictionary for the word "numeral": able to be counted
The class supports integers and floats.
New functionality has been added to this helper. Not everything that appears in Numeral has been doubled here, because simple operations such as additions would imply more cumbersomeness when used here rather than just doing 1 + 1.
However, a new random() method has been introduced here as a wrapper for PHP's Random\Randomizer(). This functionality doesn't exist in the stateful class
To mimic the str() helper, a new num() helper has been introduced with similar functionality. This helper will return a Numeral object with the value passed as a parameter.
A new cast has also been added to the Eloquent's Casts folder. This will cast integers and floats to Numerals and back.
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Lic. | License text | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Doc. | Documentation |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.