Download the PHP package matriphe/format without Composer
On this page you can find all versions of the php package matriphe/format. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package format
Format
Helpers contains common formatting, such as number, bytes, currency, phone, hash slug, format duration, and remove new line in string. Very handy for formatting things in Laravel.
Under the hood, it wraps some other great packages.
Compatibility
This latest 2.0 version works with Laravel >= 5.5. For previous version, check 1.6 version.
It requires PHP >= 7.0 and and bcmath extension.
Installation
Open composer.json
and require this line below.
Or you can run this command from your project directory.
It used Laravel auto package discovery feature.
Usage
It's really easy to use the functions, by calling the Format
facade or simply using global functions helpers.
It use internal locale, if you want to change the locale at runtime, just pass a $locale
in the function.
On this example, we use Indonesia (id) locale as default.
Format Number
Format Currency
Format Bytes
Format to Bytes
Format Phone
Format Phone Human
Format Phone Carrier
Format DateRange
Format Hashed Slug
It's very useful to generate hashed URL slug like in URL shortener service. It use UNIX timestamp salt to generate unique ID. You can also set the length and the alphabet for the output.
Note for hashed slug
If you want to save this hashed slug into MySQL, make sure the column is case sensitive. To do this, alter the column with this command.
Format Duration
It's very useful to generate duration in days, hours, minutes, and seconds.
Remove New Line in String
Will remove \n
, \r
, and spaces in string to make it in one line.
All versions of format with dependencies
gabrielelana/byte-units Version ^0.5.0
hashids/hashids Version ^2.0
propaganistas/laravel-intl Version ^2.0
propaganistas/laravel-phone Version ^4.0
sokil/php-isocodes Version ^2.1