Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Usage Milestone: Google Analytics Module google_analytics crossed 1,000 active installs. Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Release: GraphQL Compose Codegen 1.1.2 Minor update available for module graphql_compose_codegen (1.1.2). Release: Mapy.com 1.1.3 Minor update available for module mapycom (1.1.3). Release: Ckeditor5 entity browser 3.0.3 Minor update available for module ckeditor5_entity_browser (3.0.3). Release: Ckeditor5 entity browser 3.0.1 Minor update available for module ckeditor5_entity_browser (3.0.1). Release: Ckeditor5 entity browser 3.0.2 Minor update available for module ckeditor5_entity_browser (3.0.2). Release: Teamleader Integration 4.0.2 Minor update available for module teamleader (4.0.2). Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Simple OTP

No security coverage
View on drupal.org

This module provides a service for generating and validating one-time passwords (OTPs) that can be sent via email or SMS. It allows for configuration of OTP length and expiry, and offers customizability for the messages sent to users for verification purposes.

The Simple OTP module provides OTP configuration and service for both email and phone numbers. It helps us to generate and validate OTPs.

We can easily configure and integrate the OTP logic and customize the email or SMS to send an OTP to the user. This module can be used in email or phone number verification.

Features

Here, we are getting two methods generateOtp() and validateOtp() in OTP service. We can send custom OTP emails or SMS to user.

Post-Installation

After installation, we have to first configure the OTP length and OTP Expiry Time (in minutes).

Use the following service in code,

OTP for email

// Generate OTP
$otp_manager = \Drupal::service('simple_otp_service.otp_manager');
$otp = $otp_manager->generateOtp('email', '[email protected]');

// Validate OTP
$is_valid = $otp_manager->validateOtp('email', '[email protected]', '1234');

OTP for phone number

// Generate OTP
$otp_manager = \Drupal::service('simple_otp_service.otp_manager');
$otp = $otp_manager->generateOtp('phone_number', '1234567890');

// Validate OTP
$is_valid = $otp_manager->validateOtp('phone_number', '1234567890', '1234');

Similar projects

https://www.drupal.org/project/otp
https://www.drupal.org/project/otp_service

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Aug 2025
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Dormant

Releases

Version Type Core Release date
1.0.x-dev Dev 10–11 Aug 18, 2025