PHPackages                             ryanj93/php-password-toolbox - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. ryanj93/php-password-toolbox

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

ryanj93/php-password-toolbox
============================

A simple toolkit for generate, analyse and hash passwords with PHP.

1.1.4(8y ago)3142GPL-3.0-or-laterPHPPHP &gt;=7.0

Since Feb 19Pushed 8y ago1 watchersCompare

[ Source](https://github.com/RyanJ93/php-password-toolbox)[ Packagist](https://packagist.org/packages/ryanj93/php-password-toolbox)[ Docs](https://github.com/RyanJ93/php-password-toolbox#readme)[ RSS](/packages/ryanj93-php-password-toolbox/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Password toolkit (PHP edition)
==============================

[](#password-toolkit-php-edition)

Password toolkit is a simple library that will help you handling passwords with PHP without any dependencies. This library is a PHP porting from the "Password toolkit" library available for Node.js. You can use this library to generate suggested passwords, analyse user provided passwords in order to get a strength score and create a hash that can be stored within the database. Note that this library require PHP version 7.0 or greater.

Password analysis
=================

[](#password-analysis)

First, you need to create an instance of the "Analyzer" class as following:

`$analyzer = new PHPPasswordToolBox\Analyzer();`

Simple analysis:

`$analyzer->analyze($password);`

Complete analysis:

`$analyzer->setDictionaryPath('rockyou.txt')->completeAnalysis($password);`

Note that the complete analysis require a dictionary containing a list of weak passwords, passwords in this list must be separated by a break line (\\n). You can download dictionaries [here](https://wiki.skullsecurity.org/Passwords). Both methods will return an associative array containing informations about chars count, keywords and the score.

Password generation
===================

[](#password-generation)

First, you need to create an instance of the "Generator" class as following:

`$generator = new PHPPasswordToolBox\Generator();`

Random password:

`$generator->generate(12);`

Human readable password generation:

`$generator->setDictionaryPath('dictionary.txt')->generateHumanReadable(12, 2);`

Note that in order to generate human readable passwords you need a dictionary, words in the dictionary must be separated by a break line (\\n). If you are looking for an English word list, give a look [here](https://github.com/dwyl/english-words).

Password hashing
================

[](#password-hashing)

Simple hash generation:

`PHPPasswordToolBox\Hash::createSimpleHash($password);`

More complex hash generation:

`PHPPasswordToolBox\Hash::createHash($password);`

The first method will return the hash as a string, the second one will return an associative array with the hash and its parameters (salts, algorithm, loop number). If you need to compare a given password and a hash generated with the first method you can use this method:

`PHPPasswordToolBox\Hash::compareSimpleHash($password, $hash);`

While if you used the second method you can do this:

`PHPPasswordToolBox\Hash::compareHash($password, $hash);`

Are you looking for the Node.js version? Give a look [here](https://github.com/RyanJ93/password-toolbox).

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

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

Every ~4 days

Total

2

Last Release

3049d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5309759?v=4)[Enrico](/maintainers/ryanj93)[@RyanJ93](https://github.com/RyanJ93)

---

Top Contributors

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

---

Tags

hashhashing-passwordshuman-readable-passwordspasswordphprandomvalidatorsecurityencryptionpasswordhashinggeneratorhashcryptutilities

### Embed Badge

![Health badge](/badges/ryanj93-php-password-toolbox/health.svg)

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

###  Alternatives

[passwordlib/passwordlib

A Password Hashing Library

372222.4k7](/packages/passwordlib-passwordlib)[yiisoft/security

Security utilities

43499.4k6](/packages/yiisoft-security)[rollerworks/password-strength-validator

Password-strength validator for Symfony

1446.0M7](/packages/rollerworks-password-strength-validator)[paragonie/password_lock

Wraps Bcrypt-SHA2 in Authenticated Encryption

19350.6k1](/packages/paragonie-password-lock)[dragon-code/card-number

Generation and verification of card numbers using Luhn's algorithm.

6613.6k](/packages/dragon-code-card-number)[schnittstabil/csrf-tokenservice

Stateless CSRF (Cross-Site Request Forgery) token service.

15161.2k2](/packages/schnittstabil-csrf-tokenservice)

PHPackages © 2026

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