jord-jd/password-suggester

Secure, dependency-free password suggestion strategies for PHP

Maintainers

Package info

github.com/Jord-JD/password-suggester

pkg:composer/jord-jd/password-suggester

Transparency log

Fund package maintenance!

DivineOmega

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v4.0.0 2026-07-18 10:57 UTC

This package is auto-updated.

Last update: 2026-07-18 11:02:34 UTC


README

Secure, dependency-free password generation for PHP 7.1 through current releases. The default strategies now generate 20 alphanumeric characters, 20 numeric digits, or six random words using cryptographically secure randomness.

Version 4 removes the old Laravel/NIST validation dependency and global application-container mutations. By default, suggestions must contain at least 15 characters. Applications that use a breach blocklist or another password policy can inject their own validator callback.

Installation

To install Password Suggester, run the following Composer command from the root of your project.

composer require jord-jd/password-suggester

Usage

See the following basic usage example.

use JordJD\PasswordSuggester\PasswordSuggester;
use JordJD\PasswordSuggester\SuggestionStrategies\AlphanumericStrategy;
use JordJD\PasswordSuggester\SuggestionStrategies\NumbersStrategy;
use JordJD\PasswordSuggester\SuggestionStrategies\WordsStrategy;

require_once __DIR__.'/../vendor/autoload.php';

$passwordSuggester = new PasswordSuggester();

$strategy = new AlphanumericStrategy();
//$strategy = new WordsStrategy();
//$strategy = new NumbersStrategy();

echo $passwordSuggester->suggest($strategy);
echo PHP_EOL;

To apply an application-specific policy:

$passwordSuggester = new PasswordSuggester(function ($password) {
    return strlen($password) >= 20 && !myBreachServiceContains($password);
});

$passwordSuggester->setMaxAttempts(250);