Download the PHP package philiprehberger/php-password-strength without Composer
On this page you can find all versions of the php package philiprehberger/php-password-strength. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download philiprehberger/php-password-strength
More information about philiprehberger/php-password-strength
Files in philiprehberger/php-password-strength
Download philiprehberger/php-password-strength
More information about philiprehberger/php-password-strength
Files in philiprehberger/php-password-strength
Vendor philiprehberger
Package php-password-strength
Short Description Password strength validation with entropy calculation and common password detection
License MIT
Homepage https://github.com/philiprehberger/php-password-strength
Package php-password-strength
Short Description Password strength validation with entropy calculation and common password detection
License MIT
Homepage https://github.com/philiprehberger/php-password-strength
Please rate this library. Is it a good library?
Informations about the package php-password-strength
PHP Password Strength
Password strength validation with entropy calculation and common password detection.
Requirements
- PHP 8.2+
Installation
Usage
Checking password strength
Quick validation
Detailed analysis
Custom dictionary
Personal context checking
Policy-based validation
API
PasswordStrength
| Method | Description |
|---|---|
PasswordStrength::check(string $password): StrengthResult |
Analyse a password and return a result |
PasswordStrength::isStrong(string $password, int $minScore = 3): bool |
Returns true if the score meets the minimum |
PasswordStrength::analyze(string $password): StrengthReport |
Return a detailed strength report with analysis flags |
PasswordStrength::meetsPolicy(string $password, PasswordPolicy $policy): bool |
Check if a password satisfies a policy |
PasswordStrength::addDictionary(array $words): void |
Add custom dictionary words to check against |
PasswordStrength::clearDictionaries(): void |
Clear all custom dictionaries |
PasswordStrength::withContext(array $context): PendingAnalysis |
Create a pending analysis with personal context |
StrengthResult
| Property / Method | Type | Description |
|---|---|---|
score |
int |
Strength score from 0 to 4 |
entropy |
float |
Shannon entropy in bits |
isCommon |
bool |
Whether the password is in the common list |
length |
int |
Password length in characters |
suggestions |
array |
List of improvement suggestions |
label(): string |
— | Human label: very weak, weak, fair, strong, very strong |
toArray(): array |
— | Serialize to array |
StrengthReport
| Property | Type | Description |
|---|---|---|
score |
int |
Strength score from 0 to 4 |
level |
string |
Human-readable strength level |
hasLowercase |
bool |
Whether the password contains lowercase letters |
hasUppercase |
bool |
Whether the password contains uppercase letters |
hasDigits |
bool |
Whether the password contains digits |
hasSymbols |
bool |
Whether the password contains special characters |
hasRepeatedChars |
bool |
Whether the password has 3+ repeated characters in a row |
hasSequentialChars |
bool |
Whether the password has 3+ sequential characters |
hasKeyboardPattern |
bool |
Whether the password contains keyboard patterns |
length |
int |
Password length in characters |
hasPersonalContext |
bool |
Whether the password contains personal context information |
suggestions |
array |
List of improvement suggestions |
PendingAnalysis
| Method | Description |
|---|---|
analyze(string $password): StrengthReport |
Analyze a password with personal context applied |
PasswordPolicy
| Method | Description |
|---|---|
minLength(int $length): self |
Set minimum password length |
requireUppercase(): self |
Require at least one uppercase letter |
requireDigits(): self |
Require at least one digit |
requireSymbols(): self |
Require at least one special character |
minScore(int $score): self |
Set minimum strength score (0-4) |
check(string $password): bool |
Check if a password meets the policy |
Score Meanings
| Score | Label | Description |
|---|---|---|
| 0 | Very Weak | Trivial or common password |
| 1 | Weak | Low entropy or very short |
| 2 | Fair | Moderate entropy, room to improve |
| 3 | Strong | Good entropy and character variety |
| 4 | Very Strong | Excellent entropy and length |
Development
Support
If you find this project useful:
License
MIT
All versions of php-password-strength with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.2
The package philiprehberger/php-password-strength contains the following files
Loading the files please wait ...