field
field settings
instance settings

Mobile Number is a field type that provides mobile number validation and verification, and can be used for two factor authentication. It works with SMS Framework and TFA modules, respectively, and both features are optional.

The module differs from the Phone module in that it puts security and authenticity first, and focuses on mobile numbers which therefore assumes sms and smartphone capabilities by the user. The number is sanitized before saving, country is validated, the number is validated to be a mobile number type, allows uniqueness validation, and, if enabled, allows verifying number ownership by the user. For verification, codes are hashed and tokenized in the database. See the case for a dedicated mobile number field.

The module uses libphonenumber (developed by Google for use in Android) for validation, and supports the mobile number formats of the countries listed here, which is basically all of them.

Feature requests are welcomed.

Supported modules

Requirements

Installation D7

  1. Download and enable mobile_number module
  2. Download into your libraries folder the libphonenumber project under the name libphonenumber. Alternatively, you can use drush libphonenumber-download command, or install the library with Composer Manager.
  3. For mobile number verification, download, enable, and configure SMS Framework. You will need to setup an SMS gateway, which will require setting up an account and paying fees on a 3rd party service, or use SMS Framework's default logger gateway for testing.
  4. For two factor authentication, complete step 3 and download, enable, and configure TFA. Currently not available for Drupal 8.

Installation D8

  1. Install mobile_number module, preferably using composer composer require drupal/mobile_number
  2. If the module was not installed with composer, install dependencies with composer composer require giggsey/libphonenumber-for-php ^8.0
  3. For mobile number verification, download, enable, and configure SMS Framework. You will need to setup an SMS gateway, which will require setting up an account and paying fees on a 3rd party service, or use SMS Framework's default logger gateway for testing.
  4. Two factor authentication is not available for D8
Supporting organizations: 

Project information

Releases