friskals/countries

Nominal formatting and phone validation for Laravel Framework

v2.2.3 2022-01-03 02:04 UTC

This package is auto-updated.

Last update: 2025-06-29 02:07:40 UTC


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');