Download the PHP package lamansky/random-password without Composer

On this page you can find all versions of the php package lamansky/random-password. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package random-password

RandomPassword

A PHP library that uses cryptographically-secure randomization to generate a password of a given length from given sets of characters.

Installation

With Composer installed on your computer and initialized for your project, run this command in your project’s root directory:

Requires PHP 7.1 or above.

Examples

API

The library consists of a single class: Lamansky\RandomPassword\RandomPasswordFactory.

Constructor Parameters

  1. Optional: $set_codes (string or null): A configuration string indicating the character sets that should be used in generating the random password. If this is set to null, the default of u l n (equivalent to the configuration of the static alphanumeric() method) will be used.
  2. Optional: $custom_set (string): A set of characters to be used if $set_codes includes c.

Set Codes

The $set_codes string is used to specify which characters should be used in generating random passwords. The available character sets are:

Code Set Name Set Characters
L Lowercase abcdefghijklmnopqrstuvwxyz
l Unambiguous Lowercase abcdefhjkmnpqrstuvwxyz
(Letters i, g, l, and o are omitted.)
U Uppercase ABCDEFGHIJKLMNOPQRSTUVWXYZ
u Unambiguous Uppercase ABCDEFHJKLMNPQRSTUVWXYZ
(Letters I, G, and O are omitted.)
N Numbers 1234567890
n Unambiguous Numbers 2345789
(Numbers 1, 6, and 0 are omitted.)
s Symbols !@#^*_
c Custom Specified in the $custom_set variable.

Passwords will be generated by rotating between different space-separated groups in your configuration string. Here are some sample values for $set_codes with corresponding behavior:

Configuration String Behavior Sample Password
u l n The password will be generated by rotating between the u, l, and n sets (uppercase, lowercase, and numbers). The order of the rotation will be randomized. jR5nX8eH
uln Every character of the password will have a chance of being drawn from the u, l, or n sets. 29QVYbC7
ul n The password will be generated by rotating between letters (a mix of uppercase and lowercase) and numbers. 9n5h4D8X

Static Factory Methods

The RandomPasswordFactory class has various static factory methods, each of which serves as a shortcut for constructing a factory using a preconfigured value for $set_codes.

Static Method Set Codes Sample Password
alpha() u l sJtNbZtA
numeric() N 54088998
alphanumeric() u l n r9Tj4Nw5
loweralphanumeric() l n p7h2q4e2
ascii() u l n s 7R_y5M#f
custom($custom_set) c

The generate() Method

Parameters

  1. $length (int): The number of characters in the password to be generated. For security reasons, it is strongly recommended that this be set to 12 or higher.
  2. Optional: $set_codes (string or null): If set, overrides the global $set_codes value set in the constructor.
  3. Optional: $custom_set (string): If set, overrides the global $custom_set value set in the constructor.

Return Value

Returns a random password as a string.

Unit Tests

To run the development test suite, execute this command:


All versions of random-password with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.0
lamansky/secure-shuffle Version ^1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lamansky/random-password contains the following files

Loading the files please wait ....