One of my projects is a password validator for PHP which uses the entropy of a password to determine its strength. It was originally written as a quick port of another project, but required a lot of overhead to implement. By that, I mean the full
PasswordValidator object needed to be instantiated to be able to use it i.e.
$password = "Tr0ub4dor3&"; $passwordValidator = new PasswordValidator(); // get the entropy of the password $entropy = $passwordValidator->getEntropy($password);
Whilst easy enough to use, it's an extra line of code to include at each use (the
new PasswordValidator(); part). And most occasions will be to run the
Because it's a very new release to Packagist, there was no real harm in me rewriting it to make the functionality static, and remove that overhead. It can now be called as
$password = "Tr0ub4dor3&"; $entropy = GaryBell\PasswordValidator::getEntropy($password);
This release also removes support for PHP 7.3, as it's due to end maintenance in December. Anyone still applying security patches and running PHP 7.3 can use version 1.0.1 to get similar functionality. There are no plans to migrate 1.0.1 to use the static calls.