PHP Classes

PHP Password Generator Class Toolbox: Generate, analyze and create hashes of passwords

Recommend this page to a friend!
  Info   View files Example   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 161 All time: 8,888 This week: 296Up
Version License PHP version Categories
php-password-toolbox 1.0.0Custom (specified...5PHP 5, Text processing, Security
Description Author

This package can generate, analyze and create hashes of passwords.

It can generate a string that can be used as a password which may optionally be readable by people.

The package also generate a hash for the password, so it can be verified later if a given password entered by a user matches what the original password.

It may also analyze the password to tell if it matches certain characteristics like a certain length, types of characters that it contains or if it is already in a dictionary file of commonly used passwords.

Picture of Enrico Sola
Name: Enrico Sola <contact>
Classes: 5 packages by
Country: Italy Italy
Age: 29
All time rank: 3206122 in Italy Italy
Week rank: 563 Up23 in Italy Italy Up


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

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

$analyzer = new PHPPasswordToolBox\Analyzer();

Simple analysis:


Complete analysis:


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. Both methods will return an associative array containing informations about chars count, keywords and the score.

Password generation

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

$generator = new PHPPasswordToolBox\Generator();

Random password:


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.

Password hashing

Simple hash generation:


More complex hash generation:


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.

  Files folder image Files  
File Role Description
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file demo.php Example Example script
Accessible without login Plain text file Lic. License text
Plain text file php-password-toolbox.php Class Class source
Accessible without login Plain text file Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:8,888
This week:296Up