Download the PHP package kamranahmedse/php-shorthand without Composer
On this page you can find all versions of the php package kamranahmedse/php-shorthand. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kamranahmedse/php-shorthand
More information about kamranahmedse/php-shorthand
Files in kamranahmedse/php-shorthand
Package php-shorthand
Short Description Calculate the set of unique abbreviations for a given set of strings.
License MIT
Homepage https://github.com/kamranahmedse/php-abbrev
Informations about the package php-shorthand
php-shorthand
Calculate unique shorthands for a given set of strings
Inspired by ruby's abbrev module, it let's you calculate the unique set of shorthands for the given set of words.
Installation
Use the following command to install via composer
For further details you can find the package at Packagist.
Usage
Instantiate the Shorthand
class while passing the words for which you want the shorthands
It will return an associative array with the key set to the shorthand keyword and value set to the actual word that it refers to
Usage Scenarios
It can come quite handy when writing command line script that takes a number of options and the user may enter the options shorthand or maybe other cases where you want to be able to accept shorthands.
For example, in a script that accepts the options ['delete', 'create', 'update']
, in your script, it can let you infer from the option that user wanted even when they typed a shorthand as long as it is unambiguous
Contribution
Feel free to fork, enhance, open issues, create pull requests or spread the word.
License
MIT © Kamran Ahmed