zenepay/password-policy

Configurable password history and expiry policies for Laravel applications.

Maintainers

Package info

github.com/zenepay/password-policy

pkg:composer/zenepay/password-policy

Transparency log

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-08-24 04:21 UTC

This package is auto-updated.

Last update: 2026-08-24 04:40:46 UTC


README

Configurable password history and expiry policies for Laravel applications.

Installation

composer require zenepay/password-policy
php artisan vendor:publish --tag=password-policy-config
php artisan vendor:publish --tag=password-policy-migrations
php artisan migrate

User model

Add the trait to the authenticatable model:

use Zenepay\PasswordPolicy\Traits\PasswordExpirable;

class User extends Authenticatable
{
    use PasswordExpirable;
}

The package records the initial password and subsequent password changes. Password reuse checks the most recent number of hashes configured by previous_passwords_limit.

Validation

use Zenepay\PasswordPolicy\Rules\NoPreviousPassword;

'password' => [
    'required',
    'confirmed',
    NoPreviousPassword::ofUser($request->user()),
],

Middleware

Register the middleware in the host application and configure middleware_redirect_route to a route that displays the password renewal form:

'check-password-expired' => Zenepay\PasswordPolicy\Middleware\CheckPasswordExpired::class,

Expiry notifications

Run the command manually or schedule it in the host application:

php artisan password-policy:check-expiry

The command is intentionally not scheduled automatically. Configure the password broker and reset route in config/password-policy.php before enabling it.

Configuration

The package publishes config/password-policy.php. Important defaults include 90 expiry days and a five-password history limit.

License

MIT