PHPackages                             andybeak/password-checker-php - 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. andybeak/password-checker-php

ActiveLibrary

andybeak/password-checker-php
=============================

This package helps you to make it easier to check whether a user is using a risky password.

v1.0.0(6y ago)26MITPHPPHP ^7.2.18

Since Aug 1Pushed 5y ago1 watchersCompare

[ Source](https://github.com/andybeak/password-checker-php)[ Packagist](https://packagist.org/packages/andybeak/password-checker-php)[ RSS](/packages/andybeak-password-checker-php/feed)WikiDiscussions master Synced today

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

Password checker
================

[](#password-checker)

[![Build Status](https://camo.githubusercontent.com/1c2584b2e79757dd67a0d52f197ae4f924db1dbffeb5fe4c338489f4a5ef6e14/68747470733a2f2f7472617669732d63692e636f6d2f616e64796265616b2f70617373776f72642d636865636b65722d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/andybeak/password-checker-php)[![Maintainability](https://camo.githubusercontent.com/c4cbd328c35cd503a5e51c9bc3a11d7abfd944de9047bdc76ffe606a0fcc5470/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f39613664316632373066346133356437336236622f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/andybeak/password-checker-php/maintainability)[![Test Coverage](https://camo.githubusercontent.com/7524489c2ec7f71175d552337c2f51471351e7b0fbae97b21cf068c23f9a8dfd/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f39613664316632373066346133356437336236622f746573745f636f766572616765)](https://codeclimate.com/github/andybeak/password-checker-php/test_coverage)

This package helps you to make it easier to check whether a user is using a risky password.

Installation and usage
----------------------

[](#installation-and-usage)

You can use composer to install the package.

```
composer require andybeak/password-checker-php

```

It can be used like this:

```
use AndyBeak\PasswordChecker\PasswordChecker;
$passwordStrength = PasswordChecker::checkPassword('password');

```

The class returns an associative array that you can use to decide whether a password matches your password policy. The return value for the example given is:

```
array (size=6)
  'passwordLength' => int 8
  'containsDigits' => boolean false
  'containsSpecialChars' => boolean false
  'containsUpperAndLower' => boolean true
  'couldPossiblyBeAPassphrase' => boolean false
  'minimumDistanceToBadPassword' => int 1

```

### minimumDistanceToBadPassword

[](#minimumdistancetobadpassword)

This is the shortest levenshtein distance between the supplied password and all of the dictionary passwords.

If this value is 0 then the supplied password exists as an exact string in the dictionary. This means that it will be possible to brute force guess the password using the supplied dictionary.

There may or may not be value in setting a minimum acceptable distance to a bad password. It's possible that people who are blocked from using `password1234` as their password will try `password12345`, for example.

See \[[https://www.php.net/manual/en/function.levenshtein.php\](The](https://www.php.net/manual/en/function.levenshtein.php](The) PHP manual) for more details

### couldPossiblyBeAPassphrase

[](#couldpossiblybeapassphrase)

This is a very naive stab in the dark that the user could be entering a passphrase. Most password managers seem to avoid including space characters in their generated passwords. Therefore if a user types in a lengthy password (currently 20 characters) that only includes printable characters and includes at least one space then this flag will be set to true.

For example, the output for `passphrases are better than passwords` is:

```
array (size=6)
  'passwordLength' => int 37
  'containsDigits' => boolean false
  'containsSpecialChars' => boolean true
  'containsUpperAndLower' => boolean true
  'couldPossiblyBeAPassphrase' => boolean true
  'minimumDistanceToBadPassword' => int 23

```

Note that only ASCII characters from 32 to 126 are considered printable

You might be willing to relax your policy about special characters and digits if the password supplied looks like a passphrase.

Password list
-------------

[](#password-list)

I include the phpbb password list from () in the package. You can replace it with any plaintext file that uses newlines to separate passwords.

Running the tests
-----------------

[](#running-the-tests)

Install the composer dependencies using `composer install` in the package path and then run `./vendor/bin/phpunit` to run the tests.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

2474d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1386980?v=4)[Andy](/maintainers/andybeak)[@andybeak](https://github.com/andybeak)

---

Top Contributors

[![andybeak](https://avatars.githubusercontent.com/u/1386980?v=4)](https://github.com/andybeak "andybeak (1 commits)")

---

Tags

password-checkerphp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/andybeak-password-checker-php/health.svg)

```
[![Health](https://phpackages.com/badges/andybeak-password-checker-php/health.svg)](https://phpackages.com/packages/andybeak-password-checker-php)
```

PHPackages © 2026

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