PHPackages                             samasend/laravel-needs-auto-rehash - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. samasend/laravel-needs-auto-rehash

AbandonedArchivedLibrary[Authentication &amp; Authorization](/categories/authentication)

samasend/laravel-needs-auto-rehash
==================================

Automate the common password `Auth::needsRehash` routine using built-in event

v0.9.2(3y ago)662.6k↓84.4%4MITPHPPHP ^7.2|^8.0.2

Since Sep 21Pushed 3y ago1 watchersCompare

[ Source](https://github.com/SamAsEnd/laravel-needs-auto-rehash)[ Packagist](https://packagist.org/packages/samasend/laravel-needs-auto-rehash)[ RSS](/packages/samasend-laravel-needs-auto-rehash/feed)WikiDiscussions master Synced 3w ago

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

laravel-needs-auto-rehash [![From Ethiopia](https://camo.githubusercontent.com/2a51ac3f76fd38f637b5266f69ed5992dfa81ab2228248290d73569a5bb91786/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f46726f6d2d457468696f7069612d627269676874677265656e2e737667)](https://camo.githubusercontent.com/2a51ac3f76fd38f637b5266f69ed5992dfa81ab2228248290d73569a5bb91786/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f46726f6d2d457468696f7069612d627269676874677265656e2e737667)
================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#laravel-needs-auto-rehash-)

[![Build Status](https://camo.githubusercontent.com/fd274a434123cd4bd3af9f798d7360d96d6e611a61b7ed7b9c0a9af0b6c099b4/68747470733a2f2f7472617669732d63692e6f72672f53616d4173456e642f6c61726176656c2d6e656564732d6175746f2d7265686173682e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/SamAsEnd/laravel-needs-auto-rehash)[![StyleCI](https://camo.githubusercontent.com/faf30f72fc62ee078808ffdb9d948420f16d75b24197a01d607f084b7d33bcf5/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3239373132333538312f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/297123581?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/b0120d1b402a0ceebac80fef4bd0f0d5bc3220997abeec3406cd14e07f20e46b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f53616d4173456e642f6c61726176656c2d6e656564732d6175746f2d7265686173682f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/SamAsEnd/laravel-needs-auto-rehash/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/b37401a8ec75f652ad38d09e312a62428fbc00a97ca83fd65c56bd76039af930/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f53616d4173456e642f6c61726176656c2d6e656564732d6175746f2d7265686173682f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/SamAsEnd/laravel-needs-auto-rehash/?branch=master)[![License](https://camo.githubusercontent.com/1ef850f915290b45243d000a35d701e192b22706b19aed38c8fe281b02f43ecd/68747470733a2f2f706f7365722e707567782e6f72672f73616d6173656e642f6c61726176656c2d6e656564732d6175746f2d7265686173682f6c6963656e73652e737667)](https://packagist.org/packages/samasend/laravel-needs-auto-rehash)

This package automates the common password [`Hash::needsRehash`](https://laravel.com/docs/8.x/hashing#basic-usage) routine by hooking into the [built-in event system](https://laravel.com/docs/8.x/authentication#events).

Use case
--------

[](#use-case)

When a user register, Laravel uses `bcrypt` algorithm with a cost factor of `10` to hash passwords.

The problem is when you change [the default hashing algorithm](https://github.com/laravel/laravel/blob/master/config/hashing.php#L18) or when Laravel eventually changes [the default algorithm](https://github.com/laravel/framework/blob/master/src/Illuminate/Hashing/HashManager.php#L95) to `argon2i`or PHP recommended [`PASSWORD_DEFAULT` constant](https://www.php.net/manual/en/password.constants.php) changes, and you want to keep up or simply want to upgrade the `cost` factor of `bcrypt`; your changes will only be reflected on **newly registered users** or when **existing users change their password**.

You have to implement a common routine task to upgrade users' password hash by checking `Hash::needsRehash` whenever the user provides a valid credential.

Prerequisites
-------------

[](#prerequisites)

- **PHP** 7.2 or greater and 8.0.2 or greater
- **Laravel** 6.x || 7.x || 8.x || 9.x || 10.x

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

[](#installation)

```
composer require samasend/laravel-needs-auto-rehash
```

Basic Usage
-----------

[](#basic-usage)

That's it, you just need to install the package. 🚀

How does this works?
--------------------

[](#how-does-this-works)

- This magical package listen for the built-in `Illuminate\Auth\Events\Attempting` [event fired from the framework](https://laravel.com/docs/8.x/authentication#events) and validate the credentials [using the built-in infrastructure](https://laravel.com/docs/8.x/authentication#the-user-provider-contract).
- If the user password needs rehashing, it will rehash the password and update the model.

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

[](#contributing)

```
Fork it
Create your feature branch (git checkout -b my-new-feature)
Commit your changes (git commit -am 'Add some feature')
Push to the branch (git push origin my-new-feature)
Create new Pull Request

```

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% 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 ~441 days

Total

3

Last Release

1222d ago

PHP version history (2 changes)v0.9.0PHP ^7.2

v0.9.1PHP ^7.2|^8.0.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/8fd28cb32a4cca3aaf21187959977a78066f4bc4c8b110c959efcf117e6dc4c4?d=identicon)[SamAsEnd](/maintainers/SamAsEnd)

---

Top Contributors

[![SamAsEnd](https://avatars.githubusercontent.com/u/9657132?v=4)](https://github.com/SamAsEnd "SamAsEnd (20 commits)")[![arxeiss](https://avatars.githubusercontent.com/u/5103109?v=4)](https://github.com/arxeiss "arxeiss (5 commits)")

---

Tags

laravelpasswordrehashlaravelpasswordhashrehashneedsRehash

### Embed Badge

![Health badge](/badges/samasend-laravel-needs-auto-rehash/health.svg)

```
[![Health](https://phpackages.com/badges/samasend-laravel-needs-auto-rehash/health.svg)](https://phpackages.com/packages/samasend-laravel-needs-auto-rehash)
```

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k98.0M1.3k](/packages/spatie-laravel-permission)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[laravel/ai

The official AI SDK for Laravel.

9782.1M162](/packages/laravel-ai)[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

83910.6M60](/packages/php-open-source-saver-jwt-auth)[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8385.5M96](/packages/laravel-doctrine-orm)[moonshine/moonshine

Laravel administration panel

1.3k239.9k76](/packages/moonshine-moonshine)

PHPackages © 2026

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