A class that offers quick ways to make confusing/complex strings readable, for example passwords
Passwords often give confusing/difficult outputs. For example: lower case l (lima) and upper case i (indigo) are similar in many fonts, and symbols such as tilde have names that are often unknown or difficult to remember.
For example:
$password = 'lIaA3~';
... can be easily translated to:
$password_humanised = 'lima INDIGO alpha ALPHA three tilde';
The CharacterHumaniser
class offers:
- array and string output for easy display
- catches unexpected characters
- ability to add your own custom definitions to undefined symbols/letters
As a bonus, there is a joke class: BadCharacterHumaniser
which does a funny but awful attempt at the same:
$password = '$aX3k';
// can be badly converted to:
$password_humanised = 'benjamins aether XYLOPHONE cup of tea knife';
Via Composer/packagist
composer require floor9design/character-humaniser
Via git
git clone https://github.com/floor9design-ltd/character-humaniser.git
Or:
git clone git@github.com:floor9design-ltd/character-humaniser.git
This is discussed in the usage document.
The following related class has a great password generating function:
- floor9design/test-data-generator
- Use
randomPassword()
There are no specific config setup steps required. The class should autoload in PSR-4 compliant systems. If you are using the class on its own, simply include it however is most appropriate.
Tests can be run as follows:
./vendor/phpunit/phpunit/phpunit
The following tests and also creates code coverage (usually maintained at 100%)
./vendor/phpunit/phpunit/phpunit --coverage-html docs/tests/
Static analysis/code review can be performed by using phpstan:
./vendor/bin/phpstan
A changelog is generated here:
This software is available under the MIT licence.