Skip to content

Turns difficult strings (such as passwords) into easy to read strings ideal for sharing

License

Notifications You must be signed in to change notification settings

floor9design-ltd/character-humaniser

Repository files navigation

character-humaniser

Latest Version Packagist Software License

Build Status Code Coverage

Github Downloads Packagist Downloads

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

Latest Version Packagist

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

Packagist Downloads

composer require floor9design/character-humaniser

Via git

Github Downloads

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:

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

Build Status Code Coverage

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.

About

Turns difficult strings (such as passwords) into easy to read strings ideal for sharing

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages