PHPackages                             vanthao03596/laravel-password-history - 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. vanthao03596/laravel-password-history

ActiveLibrary

vanthao03596/laravel-password-history
=====================================

Keep a password history of your users to prevent them from reusing the same password like Facebook, Google

v1.1(5y ago)134MITPHPPHP ^7.3 || ^8.0

Since Apr 4Pushed 5y ago1 watchersCompare

[ Source](https://github.com/vanthao03596/laravel-password-history)[ Packagist](https://packagist.org/packages/vanthao03596/laravel-password-history)[ Docs](https://github.com/vanthao03596/laravel-password-history)[ GitHub Sponsors](https://github.com/vanthao03596)[ RSS](/packages/vanthao03596-laravel-password-history/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (9)Versions (3)Used By (0)

Laravel password history
========================

[](#laravel-password-history)

[![Latest Version on Packagist](https://camo.githubusercontent.com/95b43fc476736baceb0256a2be17c43ce18789ad2bba9d1accb9ae0f11c1a318/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76616e7468616f30333539362f6c61726176656c2d70617373776f72642d686973746f72792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vanthao03596/laravel-password-history)[![GitHub Tests Action Status](https://camo.githubusercontent.com/5b3416fa6bf43d6502bfc7eb9c5aae069df71d50032a759b1ff521570c3407f8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f76616e7468616f30333539362f6c61726176656c2d70617373776f72642d686973746f72792f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/vanthao03596/laravel-password-history/actions?query=workflow%3ATests+branch%3Amaster)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/f820d300e17de6f3ddd34afadfa55b792961cf8655abbb20a709372bd1c6d592/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f76616e7468616f30333539362f6c61726176656c2d70617373776f72642d686973746f72792f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/vanthao03596/laravel-password-history/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/66ff456aadd21a61aee7c8f05d3dba3d06fe4bc8555f418f46587117429dabb0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f76616e7468616f30333539362f6c61726176656c2d70617373776f72642d686973746f72792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vanthao03596/laravel-password-history)

Keep a password history of your users to prevent them from reusing the same password, for security reasons like what Google, Apple does.

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

[](#installation)

You can install the package via composer:

```
composer require vanthao03596/laravel-password-history
```

You can publish and run the migrations with:

```
php artisan vendor:publish --provider="Vanthao03596\LaravelPasswordHistory\LaravelPasswordHistoryServiceProvider" --tag="password-history-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --provider="Vanthao03596\LaravelPasswordHistory\LaravelPasswordHistoryServiceProvider" --tag="password-history-config"
```

This is the contents of the published config file:

```
return [
    /**
     * The table name to save your password histories.
     */
    'table_name' => 'password_histories',

    /*
     * The fully qualified class name of the password_histories model.
     */
    'password_history_model' => \Vanthao03596\LaravelPasswordHistory\Models\PasswordHistory::class,

    /*
     * The number of months you want to check against new password.
     */

     'months_to_check' => 12,
];
```

Usage
-----

[](#usage)

To make an Eloquent model store password histories just add the `\Vanthao03596\LaravelPasswordHistory\HasPasswordHistory` trait to it:

```
use Illuminate\Database\Eloquent\Model;
use Vanthao03596\LaravelPasswordHistory\HasPasswordHistory;

class YourModel extends Model
{
    use HasPasswordHistory;

    ...
}
```

Validation Rules
----------------

[](#validation-rules)

And there is a validation rule for you to check the entire password history agaist the new password in laravel validation rules.

```
use Vanthao03596\LaravelPasswordHistory\Rules\NotInPasswordHistory;
//...

$rules = [
    // ...
    'password' => [
       'required',
       'confirmed',
       new NotInPasswordHistory(request()->user()),
    ]
    // ...
];

$this->validate(...);
```

Cleaning up the log
-------------------

[](#cleaning-up-the-log)

After using the package for a while you might have recorded a lot of password history. This package provides an artisan command password-history:clean to clean the history.

```
php artisan password-history:clean
```

```
//app/Console/Kernel.php

protected function schedule(Schedule $schedule)
{
   $schedule->command('password-history:clean')->daily();
}
```

Overwrite the months to keep per call

```
php artisan password-history:clean --months=6
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [phamthao](https://github.com/phamthao)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

1863d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/34786441?v=4)[Pham Thao](/maintainers/vanthao03596)[@vanthao03596](https://github.com/vanthao03596)

---

Top Contributors

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

---

Tags

vanthao03596laravel-password-history

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/vanthao03596-laravel-password-history/health.svg)

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

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k43.5M5.2k](/packages/larastan-larastan)[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M532](/packages/laravel-passport)[studio/laravel-totem

A Laravel package to manage your cron jobs through a beautiful dashboard

1.8k1.1M](/packages/studio-laravel-totem)[bavix/laravel-wallet

It's easy to work with a virtual wallet.

1.3k1.1M11](/packages/bavix-laravel-wallet)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

44643.1k1](/packages/pressbooks-pressbooks)[spatie/laravel-morph-map-generator

Automatically generate morph maps in your Laravel application

73464.9k1](/packages/spatie-laravel-morph-map-generator)

PHPackages © 2026

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