PHPackages                             olivierdijkstra/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. olivierdijkstra/laravel-needs-auto-rehash

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

olivierdijkstra/laravel-needs-auto-rehash
=========================================

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

v0.10.0(5y ago)01.5kMITPHPPHP ^8.0

Since Sep 21Pushed 5y agoCompare

[ Source](https://github.com/OlivierDijkstra/laravel-needs-auto-rehash)[ Packagist](https://packagist.org/packages/olivierdijkstra/laravel-needs-auto-rehash)[ RSS](/packages/olivierdijkstra-laravel-needs-auto-rehash/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (4)Versions (3)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.
- **Laravel** 6.x || 7.x || 8.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

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87% 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 ~230 days

Total

2

Last Release

1882d ago

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

v0.10.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/24614558?v=4)[Oli](/maintainers/OlivierDijkstra)[@OlivierDijkstra](https://github.com/OlivierDijkstra)

---

Top Contributors

[![SamAsEnd](https://avatars.githubusercontent.com/u/9657132?v=4)](https://github.com/SamAsEnd "SamAsEnd (20 commits)")[![OlivierDijkstra](https://avatars.githubusercontent.com/u/24614558?v=4)](https://github.com/OlivierDijkstra "OlivierDijkstra (3 commits)")

---

Tags

laravelpasswordhashrehashneedsRehash

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k102.4M1.4k](/packages/spatie-laravel-permission)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M132](/packages/laravel-pulse)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M307](/packages/laravel-horizon)[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

84611.1M64](/packages/php-open-source-saver-jwt-auth)[illuminate/database

The Illuminate Database package.

2.8k54.9M11.7k](/packages/illuminate-database)

PHPackages © 2026

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