Usage
Country Flag SVG (optional)
Example response
Available Functions
getAll
get all available countries
findOneByCountryCode
find country by ISO 3166-1 alpha-2
findByCountryCode
find countries by ISO 3166-1 alpha-2
findOneByDialCode
find country by dial code Eg.
findByDialCode
find countries by dial code Eg.
findByKeyword
find countries with keyword Eg.
groupCountriesByFirstLetter
group countries by the first letter of their name
getAll()
, findByKeyword()
, findByCountryCode()
functions support filter option for secondary dial codes. As a default withSecondary
is true
. withSecondary
with true option will return list of dial codes available for specific country.
Example.
Country
formatPhoneNumber(phone, format?)
format phone number with dial code, second param accept PhoneNumberFormat
name
get name attr from country
dialCode
or dial_code
get name dial code from country
code
get code attr from country
flag
get flag emoji attr from country
preferred
get preferred attr from country
Sample Usage of formatPhoneNumber()
From version 5.0, you will need to pass PhoneNumberUtil instance to Country list instance using setPhoneNumberUtil
formatPhoneNumber()
use google-libphonenumber
package. For more information about the package, please visit to original documentation.
Last updated