friskals / countries
Nominal formatting and phone validation for Laravel Framework
Installs: 14 754
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 2
Open Issues: 0
Requires
- php: >=7.2
README
This package allow you
- Set the nominal and currency format of a value based on the given country.
- Validate and transform phone number of a particular country.
Instalation
- Install with composer
composer require friskals/countries
For Laravel >=5.5 that's all. You don't need any configurations since it's already handled by Laravel Package Discovery
but for Lumen you need a simple configuration.
Configuration
The default are set in config/country.php
.
Lumen
- Load your configuration file in
bootstrap/app.php
$app->configure('country');
- And register your provider at
bootstrap/app.php
$app->register(Friskals\Countries\Providers\CountryServiceProvider::class);
Usage
- Format Currency
$nominal_currency = Friskals\Countries\CountryLoader::country('ID')->format_currency(1000);
- Format Nominal
$nominal = Friskals\Countries\CountryLoader::country('ID')->format_nominal(1000);
- Validate Phone
$is_validated = Friskals\Countries\CountryLoader::country('ID')->validate_phone('+6208120812081');
- Transform Phone
$phone = Friskals\Countries\CountryLoader::country('ID')->transform_phone('+6208120812081');