innoweb/silverstripe-international-phone-number-field

Adds a phone filed using Google's libphonenumber.

3.0.4 2019-11-20 05:32 UTC

This package is auto-updated.

Last update: 2020-09-20 07:31:33 UTC


README

Version License

Introduction

Adds a form field for international phone numbers using [Google's libphonenumber] (https://github.com/googlei18n/libphonenumber) and the [jQuery intl-tel-input plugin] (https://github.com/jackocnr/intl-tel-input).

Requirements

Installation

Install the module using composer:

composer require innoweb/silverstripe-international-phone-number-field dev-master

Then run dev/build.

Configuration

In your project config you can configure the following options for the InternationalPhoneNumberField class:

  • geolocation_service: Uses IP location to determine the current users's country code. This can be either 'ipstack' or 'ipinfo'. Defaults to false.
  • geolocation_api_key: API key for [ipstack.com] (https://ipstack.com) or [ipinfo.io] (https://ipinfo.io).
  • geolocation_protocol: Protocol to be used to connecto to geolocation service. Defaults to 'https'.
  • initial_country: country code for initially shown country in the phone number field. deafults to 'auto', in which case the location is determined using geolocation if that's set up.
  • only_countries: array of country codes available for selection. Defaults to all countries.
  • preferred_countries: array of country codes pushed to the top of the dropdown list. Deafults to none, all countries are listed alphabetically.
  • excluded_countries: array of country codes to be excluded from the dropdown lost. Deafults to none.

License

BSD 3-Clause License, see License