PHPackages                             fekharmensour/otp-mailer - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. fekharmensour/otp-mailer

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

fekharmensour/otp-mailer
========================

Standalone OTP mailer package for Laravel (send OTP codes)

v1.0.0(3mo ago)22↓50%MITPHPPHP &gt;=8.1

Since Feb 5Pushed 3mo agoCompare

[ Source](https://github.com/Fekharmensour/otp-mailer)[ Packagist](https://packagist.org/packages/fekharmensour/otp-mailer)[ RSS](/packages/fekharmensour-otp-mailer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

otp-mailer
==========

[](#otp-mailer)

Standalone OTP mailer package for Laravel — send one-time passwords (OTP) to user emails.

Installation
------------

[](#installation)

1. Require the package via Composer:

```
composer require fekharmensour/otp-mailer
```

2. (Optional) If your app does not auto-discover packages, register the service provider and alias in `config/app.php`:

- Provider: `Fekharmensour\OtpMailer\OtpMailerServiceProvider`
- Alias: `OtpMailer` =&gt; `Fekharmensour\OtpMailer\Facades\OtpMailer`

Publish configuration
---------------------

[](#publish-configuration)

The package ships a config file. Publish it with this command:

```
php artisan vendor:publish --provider="Fekharmensour\OtpMailer\OtpMailerServiceProvider" --tag=config
```

This will copy `config/otp-mailer.php` to your application's config folder. You can also copy `config/otp-auth.php` from the package if you need the legacy compatibility file.

Environment / SMTP setup
------------------------

[](#environment--smtp-setup)

The package sends emails using Laravel's mail system. Add your SMTP credentials to `.env`. For example (Gmail app password):

```
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=youremail@gmail.com
MAIL_PASSWORD=your_app_password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=youremail@gmail.com
MAIL_FROM_NAME="Your App"
```

Note: For Gmail use an App Password (requires 2FA). Replace `your_app_password` with that app password.

Usage (simple route)
--------------------

[](#usage-simple-route)

The package exposes a facade `OtpMailer` (and backward-compatible `OtpAuth`). Use `generateAndSend(string $email)` to create and email a 6-digit OTP, and `validate(string $email, string $code)` to validate it.

Example route (routes/web.php):

```
use Fekharmensour\OtpMailer\Facades\OtpMailer;
use Illuminate\Http\Request;

Route::get('/send-otp', function () {
	$email = 'user@example.com';
	$code = OtpMailer::generateAndSend($email);

	return "OTP sent to {$email}"; // do not reveal the code in production
});

Route::post('/verify-otp', function (\\Illuminate\\Http\\Request $request) {
	$email = $request->input('email');
	$code = $request->input('code');

	$valid = OtpMailer::validate($email, $code);

	return response()->json(['valid' => $valid]);
});
```

Usage (controller)
------------------

[](#usage-controller)

In a controller you can call the same facade methods:

```
use Fekharmensour\OtpMailer\Facades\OtpMailer;

public function send(Request $request)
{
	$email = $request->input('email');
	OtpMailer::generateAndSend($email);

	return back()->with('status', 'OTP sent');
}
```

Configuration
-------------

[](#configuration)

Open `config/otp-mailer.php` to change TTL, cache prefix, or the Notification class used to send the email. The default notification class is `Fekharmensour\\OtpMailer\\Notifications\\OtpNotification`.

Troubleshooting
---------------

[](#troubleshooting)

- Ensure your mail settings in `.env` are correct and that the app can send mail (try `php artisan tinker` + `\\Mail::raw('test', function($m){$m->to('you@example.com')->subject('test');});`).
- For Gmail use an App Password and enable the correct security settings.

License
-------

[](#license)

MIT

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance82

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

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

Unknown

Total

1

Last Release

96d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/24359f6af841ca698e13cd0a6d4461c5c58f158e609f4f6a9e61e78342cfdacb?d=identicon)[Fekharmensour](/maintainers/Fekharmensour)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/fekharmensour-otp-mailer/health.svg)

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

###  Alternatives

[mckenziearts/laravel-notify

Flexible flash notifications for Laravel

1.7k1.1M5](/packages/mckenziearts-laravel-notify)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[laravel-notification-channels/apn

Apple APN Push Notification Channel

2021.9M4](/packages/laravel-notification-channels-apn)[laravel-notification-channels/microsoft-teams

A Laravel Notification Channel for Microsoft Teams

1603.0M7](/packages/laravel-notification-channels-microsoft-teams)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[illuminate/mail

The Illuminate Mail package.

5910.1M391](/packages/illuminate-mail)

PHPackages © 2026

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