Download the PHP package macmotp/codegen without Composer
On this page you can find all versions of the php package macmotp/codegen. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download macmotp/codegen
More information about macmotp/codegen
Files in macmotp/codegen
Package codegen
Short Description Generate human friendly codes
License MIT
Homepage https://github.com/macmotp/codegen
Informations about the package codegen
Code Generator
Generate human friendly codes
Useful for referral codes, receipt codes, code references.
Requirements
- PHP >= 8.1
for PHP 7.4, use branch v0.1.4
for PHP 8.0, use branch v0.1.5
Installation
Install the package via composer:
Usage
Create semantic and sanitized reference codes from any string
Create collections of codes
Once the possibilities are running low due to lack of letters from the source, it automatically applies random letters. Please note that this package does not guarantee uniqueness on its results.
Configuration
Set configuration parameters
List of methods for configuration
setCodeLength(int $length)
: total length of the generated code;prepend(string $prepend)
: prepend a string;append(string $append)
: append a string;setMaxAttempts(int $maxAttempts)
: set the maximum number of attempts;sanitizeLevel(int $sanitizeLevel)
: read below;
Sanitize levels
Sometimes the purpose of human-readable codes is to avoid confusion while reading/spelling. Therefore, is possible to apply some filters to remove similar graphic letters/digits.
Choose between 3 different levels of sanitization
- Level 1. Low/Default: will filter out anything is not a letter or a digit
- Level 2. Medium: will filter out (O - 0 - Q - I - 1) characters
- Level 3. High: will filter out (2 - Z - 4 - A - 5 - S - 8 - B - U - V - Y) characters
Levels are inclusive, e.g. the highest level will apply also filters of level low and medium
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
All versions of codegen with dependencies
ext-intl Version *