Download the PHP package stonec0der/shorten-nums without Composer
On this page you can find all versions of the php package stonec0der/shorten-nums. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stonec0der/shorten-nums
More information about stonec0der/shorten-nums
Files in stonec0der/shorten-nums
Package shorten-nums
Short Description Shorten some numbers to this notation 1000 => 1K.
License MIT
Homepage https://github.com/stonec0der/shorten-nums
Informations about the package shorten-nums
Shorten Numbers
This is simple package to convert 12894090 views to 12.9M views. Feel free to use.
Installation
You can clone this repo
Or via composer:
Publish the configuration file with
This will publish a config file shorten-nums.php in the config folder. Set your default precision
Usage
Let's say you have a big integer value being return like 12894090 (views) and you want to display it like this 12.8M (views).
If you do not need the config file you can directly pass the precision when calling any method, else the default will be use
If you expect the value to be between 999,999 & 999,999,999. You can directly call a method associated with Millions
In most case you will want to use . If a value less than 999 is passed the value is return as it, if it greater than 999 Trillions return
Testing
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.