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. [Utility &amp; Helpers](/categories/utility)
4. /
5. salimmbise/otp-library

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

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 yesterday

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 31% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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

651d ago

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

1.1.0PHP &gt;=7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/105650566?v=4)[Salym Mbisse](/maintainers/devmpemba)[@devmpemba](https://github.com/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.7k38.9k](/packages/matomo-matomo)[utopia-php/messaging

A simple, light and advanced PHP messaging library

23236.1k6](/packages/utopia-php-messaging)

PHPackages © 2026

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