bronanza / brutils
Common php utilities
dev-master
2017-10-24 15:50 UTC
Requires
- illuminate/support: ^5.4
Requires (Dev)
- peridot-php/leo: ^1.6
- peridot-php/peridot: ^1.19
This package is not auto-updated.
Last update: 2024-11-24 05:32:26 UTC
README
PHP common utilities with laravel support.
Installation
Add the following to composer.json
. Then run composer update
"bronanza/brutils": "dev-master"
Optional
For laravel support, open config/app.php
and register service provider to the providers
array
Bronanza\Brutils\ServiceProvider::class
In the same config file config/app.php
add the following to the aliases array
NumberFormatter => Bronanza\Brutils\Number\FormatterFacade::class,
CurrencyFormatter => Bronanza\Brutils\Currency\FormatterFacade::class,
Run the command below to publish the package config file config/brutils.php
php artisan vendor:publish
Quick Usage
Formatter
$formatter = new \Bronanza\Brutils\Number\Formatter(0, ',', '.');
$formatter->format(10000) === '10.000';
$currencyFormatter = new \Bronanza\Brutils\Currency\Formatter($formatter, '$');
$formatter->format(10000) === '$10.000';
// Or if you've registered the facades (config based on config/brutils.php)
NumberFormatter::format(10000) === '10.000';
CurrencyFormatter::format(10000) === '$10.000';
License
MIT