Download the PHP package phlak/strgen without Composer
On this page you can find all versions of the php package phlak/strgen. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package strgen
Short Description Generate secure random strings (e.g. passwords / salts)
License MIT
Informations about the package strgen
PHP library for simple secure random string generation (e.g. - passwords / salts)
Created by Chris Kankiewicz (@PHLAK)
Requirements
- PHP >= 7.2
Install with Composer
Usage
Character Sets
StrGen has a few built-in character sets available for ease of use. You can
specify which set(s) to use by passing a character set or an array of sets to
the charset()
method.
Example using built-in sets:
Available presets:
Key | Character Set |
---|---|
StrGen\CharSet::LOWER_ALPHA |
abcdefghijklmnopqrstuvwxyz |
StrGen\CharSet::UPPER_ALPHA |
ABCDEFGHIJKLMNOPQRSTUVWXYZ |
StrGen\CharSet::MIXED_ALPHA |
abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ |
StrGen\CharSet::NUMERIC |
0123456789 |
StrGen\CharSet::ALPHA_NUMERIC |
abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789 |
StrGen\CharSet::SPECIAL |
!@#$%^&*()-_=+.?{}[]<>:;/\\|~ |
StrGen\CharSet::ALL |
abcdefghijklmnopqrstuvwxyz br>`ABCDEFGHIJKLMNOPQRSTUVWXYZ``0123456789` `!@#$%^&*()-_=+.?{}[]<:;/\|~` |
Custom sets:
You can also manually define a character set by passing a string of characters
to the charset()
method.
Convenience Functions
StrGen also has built-in convenience functions for generating strings from the included character sets or a custom character set.
Changelog
A list of changes can be found on the GitHub Releases page.
Troubleshooting
For general help and support join our Spectrum community.
Please report bugs to the GitHub Issue Tracker.
Copyright
This project is licensed under the MIT License.