PHPackages                             codetyme/laravel-temp-password - 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. codetyme/laravel-temp-password

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

codetyme/laravel-temp-password
==============================

A Laravel package to generate temporary passwords

v1.0.0(1y ago)17MITPHPPHP ^8.0

Since Apr 19Pushed 1y ago1 watchersCompare

[ Source](https://github.com/codetyme/laravel-temp-password)[ Packagist](https://packagist.org/packages/codetyme/laravel-temp-password)[ RSS](/packages/codetyme-laravel-temp-password/feed)WikiDiscussions main Synced 1mo ago

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

---

🔐 Laravel Temp Password
=======================

[](#-laravel-temp-password)

A Laravel package to generate **one-time, time-limited temporary passwords** for user authentication. These passwords can be used in place of regular passwords **during login** and automatically expire after a configurable period (e.g., 5 minutes).

---

🚀 Features
----------

[](#-features)

- No need to modify your existing login logic
- Supports default and custom user models
- Auto-expires passwords (default: 5 minutes)
- Optional CLI command to generate temporary passwords
- Supports password strength levels: `simple`, `medium`, `strong`
- Uses Laravel's built-in authentication system

---

📦 Installation
--------------

[](#-installation)

```
composer require codetyme/laravel-temp-password
```

---

📂 Publish Config &amp; Migrations
---------------------------------

[](#-publish-config--migrations)

```
php artisan vendor:publish --provider="codetyme\TempPassword\TempPassServiceProvider" --tag=config
php artisan migrate
```

This will:

- Publish the `config/temp-password.php` file
- Create the `temp_passwords` database table

---

⚙️ Configuration
----------------

[](#️-configuration)

Your published config file looks like this:

```
return [
    'enabled' => env('TEMP_PASS_ENABLED', true),

    'expiry_minutes' => env('TEMP_PASS_EXPIRY_TIME', 5), // Valid for 5 minutes

    'length' => env('TEMP_PASS_LENGTH', 8), // Default password length

    'strength' => env('TEMP_PASS_STRENGTH', 'medium'), // simple | medium | strong
];
```

You can override these settings in your `.env` file if needed:

```
TEMP_PASS_ENABLED=true
TEMP_PASS_EXPIRY_TIME=5
TEMP_PASS_LENGTH=10
TEMP_PASS_STRENGTH=strong
```

---

🧠 How It Works
--------------

[](#-how-it-works)

Once installed, the package automatically hooks into Laravel’s default authentication.
No need to change `Auth::attempt()` or override any guards.

You can log in with either:

- Regular user password
- A one-time, time-limited temporary password

---

🔐 Usage
-------

[](#-usage)

### 📌 Generate a Temp Password (Programmatically)

[](#-generate-a-temp-password-programmatically)

```
use codetyme\TempPassword\Facades\TempPass;

// Using default settings
$password = TempPass::generate($user);

// Custom length
$password = TempPass::generate($user, 12);

// Custom length + strength
$password = TempPass::generate($user, 16, 'strong');
```

---

### 🖥️ Generate via Artisan Command (Optional)

[](#️-generate-via-artisan-command-optional)

```
php artisan temp-password:generate
```

#### Options:

[](#options)

OptionDescription`--email`User's email (required or prompted)`--model`Fully qualified model class (optional)`--length`Password length (optional)`--strength`Password strength (optional)#### Examples:

[](#examples)

```
# Prompt for email and use default model (App\Models\User)
php artisan temp-password:generate

# Provide email directly
php artisan temp-password:generate --email=someone@example.com

# Use a custom model
php artisan temp-password:generate --email=someone@example.com --model=App\\Models\\Customer

# Use a custom length
php artisan temp-password:generate --email=someone@example.com --length=10

# Use a custom length + strength
php artisan temp-password:generate --email=someone@example.com --length=15 --strength=strong
```

---

🔧 Example Use in Tinker
-----------------------

[](#-example-use-in-tinker)

```
php artisan tinker
```

```
$user = App\Models\User::first();
$password = TempPass::generate($user);

Auth::attempt(['email' => $user->email, 'password' => $password]); // returns true ✅
```

---

📁 Database Table
----------------

[](#-database-table)

The package creates a `temp_passwords` table with the following structure:

ColumnDescription`authenticatable_id`ID of the user`authenticatable_type`User model class (e.g. App\\Models\\User)`temp_password`Bcrypt-hashed temp password`used`Marked true after first use`created_at`For expiry check---

🛡️ Security Notes
-----------------

[](#️-security-notes)

- Passwords are hashed using `bcrypt` before storing
- Temp passwords are one-time use only
- Expire automatically after the configured minutes

---

📚 Developer
-----------

[](#-developer)

Rohit Suthar, Mumbai Email:

---

📚 License
---------

[](#-license)

MIT License — open-source and free to use.

---

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance50

Moderate activity, may be stable

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

Unknown

Total

1

Last Release

385d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c99e1a228aad99e50b238e247d44b020613371c7b141f49069c8b6532b8f81e1?d=identicon)[codetyme](/maintainers/codetyme)

---

Top Contributors

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

---

Tags

laravellaravel-packageone-time-passwordtemporay-passwordtime-limited-temporary-password

### Embed Badge

![Health badge](/badges/codetyme-laravel-temp-password/health.svg)

```
[![Health](https://phpackages.com/badges/codetyme-laravel-temp-password/health.svg)](https://phpackages.com/packages/codetyme-laravel-temp-password)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M683](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M157](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M210](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M858](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

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