floor9design / character-humaniser
Turns difficult strings into easy to read strings ideal for sharing
Installs: 4 968
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=7.4
- ext-json: *
Requires (Dev)
- mockery/mockery: ^1
- phpstan/phpstan: ^1.0.0
- phpunit/phpunit: ^11.0||^10.0||^9
README
A class that offers quick ways to make confusing/complex strings readable, for example passwords
Introduction
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';
Features
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';
Install
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
Usage
This is discussed in the usage document.
Recommended
The following related class has a great password generating function:
- floor9design/test-data-generator
- Use
randomPassword()
Setup
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.
Testing
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
Credits
Changelog
A changelog is generated here:
License
This software is available under the MIT licence.