PHPackages                             salimmbise/otp-library - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. salimmbise/otp-library

ActiveLibrary

salimmbise/otp-library
======================

A simple OTP library for PHP

1.1.0(1y ago)016MITPHPPHP &gt;=7.4

Since Sep 20Pushed 1y ago1 watchersCompare

[ Source](https://github.com/devmpemba/otp-library-php)[ Packagist](https://packagist.org/packages/salimmbise/otp-library)[ RSS](/packages/salimmbise-otp-library/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

OTP Library PHP
---------------

[](#otp-library-php)

How to Install the Package
--------------------------

[](#how-to-install-the-package)

```
composer require salimmbise/otp-library
```

How to Send OTP
---------------

[](#how-to-send-otp)

At first make sure you run composer require and publish the Vendor, then import this package in order to use it. Below is example of how to use this library in Laravel Application:

```
use SalimMbise\OtpLibrary\OtpMailer;

Route::get('/send-otp', function () {
    try {
        // Instantiate the OtpMailer class
        $otpMailer = new OtpMailer();

        // Generate a test OTP
        $otp = rand(100000, 999999);

        // Use a test email to send the OTP
        $testEmail = 'test@example.com';

        // Send the OTP email
        $otpMailer->sendOtpEmail($testEmail, $otp);

        return "OTP email sent successfully to $testEmail with OTP: $otp";
    } catch (\Exception $e) {
        return "Failed to send OTP email. Error: " . $e->getMessage();
    }
});
```

How to Validate OTP
-------------------

[](#how-to-validate-otp)

```
use SalimMbise\OtpLibrary\OtpService;

Route::get('/validate-otp', function () {
    try {
        // Instantiate the OtpService class
        $otpService = new OtpService();

        $email = $request->input('example@email.com');
        $otp = $request->input('340123');

        $isValid = $this->otpService->verifyOtp($email, $otp);

        if ($isValid) {
            return response()->json(['message' => 'OTP verified successfully']);

        } else {

            return response()->json(['message' => 'OTP verification failed'], 400);
        }

    } catch (\Exception $e) {
        return "Failed to send OTP email. Error: " . $e->getMessage();
    }
});
```

Happy Coding!

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

596d ago

PHP version history (2 changes)v1.0.0PHP &gt;=8.0

1.1.0PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/5359b51116193893bb3507189954426e8e55224b29d66510494ebc777e2914ce?d=identicon)[devmpemba](/maintainers/devmpemba)

---

Top Contributors

[![devmpemba](https://avatars.githubusercontent.com/u/105650566?v=4)](https://github.com/devmpemba "devmpemba (8 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/salimmbise-otp-library/health.svg)

```
[![Health](https://phpackages.com/badges/salimmbise-otp-library/health.svg)](https://phpackages.com/packages/salimmbise-otp-library)
```

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.4k37.3k](/packages/matomo-matomo)[simplesamlphp/simplesamlphp

A PHP implementation of a SAML 2.0 service provider and identity provider.

1.1k12.4M192](/packages/simplesamlphp-simplesamlphp)[getkirby/cms

The Kirby core

1.5k535.5k350](/packages/getkirby-cms)[saithink/saiadmin

webman plugin

2709.9k1](/packages/saithink-saiadmin)[jelix/jelix

Jelix PHP framework

83101.5k4](/packages/jelix-jelix)[doppar/framework

The Doppar Framework

366.7k8](/packages/doppar-framework)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
