2017 © Pedro Pelรกez
 

library password

A simple library to generate passwords

image

jarne/password

A simple library to generate passwords

  • Monday, April 2, 2018
  • by jarne
  • Repository
  • 1 Watchers
  • 1 Stars
  • 84 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 10 Versions
  • 2 % Grown

The README.md

password

A simple library to generate passwords, (*1)


, (*2)

Packagist version PHP version CircleCI License , (*3)

#

โ€ข Install
โ€ข Usage
โ€ข Examples
โ€ข Contribution
โ€ข License, (*4)

๐Ÿ“ฆ Install

This library requires PHP 7.2 or newer in order to work correctly. You can install it with:, (*5)

$ composer require jarne/password

If you don't like Composer, you can also clone the repository with:, (*6)

$ git clone https://github.com/jarne/password

๐Ÿ‘จโ€๐Ÿ’ป Usage

There are two functions in this library: - one to generate a random password - and one to generate a random one which is easy to remember because it sounds like a real word, (*7)

The arguments are the same for both functions:, (*8)

/**
 * Generate a password
 *
 * @param int $length
 * @param int $lettersChance
 * @param int $numbersChance
 * @param int $specialCharactersChance
 * @return string
 */
public function generate(
    int $length = 8,
    int $lettersChance = 1,
    int $numbersChance = 1,
    int $specialCharactersChance = 1
): string
/**
 * Generate an easy to remember password
 *
 * @param int $length
 * @param int $lettersChance
 * @param int $numbersChance
 * @param int $specialCharactersChance
 * @return string
 */
public function generateEasyToRemember(
    int $length = 8,
    int $lettersChance = 1,
    int $numbersChance = 1,
    int $specialCharactersChance = 1
): string

See the examples section for a short code example how to use it., (*9)

โŒจ๏ธ Examples

Here are some examples how to use the functions., (*10)

Generate an 8-character long password:, (*11)

$password = new Password();

$yourPassword = $password->generate();

echo "Your new password is " . $yourPassword;

If your password should only be 5 characters long, just change the second line to:, (*12)

$yourPassword = $password->generate(5);

It's also possible to generate a password with more numbers than letters, for example:, (*13)

$yourPassword = $password->generate(5, 1, 15, 1);

In the code above, the letter chance is set to 1, the numbers chance to 15, and the special characters chance to 1, so it's likely that the password contains more numbers than other characters., (*14)

๐Ÿ™‹โ€ Contribution

Contributions are always very welcome! It's completely equal if you're a beginner or a more experienced developer., (*15)

Please read our Contribution Guidelines before creating an issue or submitting a pull request., (*16)

Thanks for your interest ๐ŸŽ‰๐Ÿ‘!, (*17)

๐Ÿ‘จโ€โš–๏ธ License

MIT, (*18)

The Versions

02/04 2018

dev-master

9999999-dev https://github.com/jarne/password

A simple library to generate passwords

  Sources   Download

CC-BY-SA-4.0 Creative Commons Attribution-ShareAlike 4.0

The Requires

  • php >=7.2

 

The Development Requires

library password generate characters vowels

10/03 2018

1.3.1

1.3.1.0 https://github.com/jarne/password

A simple library to generate passwords

  Sources   Download

CC-BY-SA-4.0

The Requires

  • php >=7.2

 

The Development Requires

library password generate characters vowels

24/01 2018

1.3.0

1.3.0.0

A simple library to generate passwords

  Sources   Download

Creative Commons Attribution-ShareAlike 4.0 International License

The Requires

  • php >=7.2

 

The Development Requires

30/07 2017

1.2.4

1.2.4.0

A simple library to generate passwords

  Sources   Download

Creative Commons Attribution-ShareAlike 4.0

The Requires

  • php >=7.1

 

The Development Requires

30/07 2017

1.2.3

1.2.3.0

A simple library to generate passwords

  Sources   Download

Creative Commons Attribution-ShareAlike 4.0

The Requires

  • php >=7.1

 

The Development Requires

28/07 2017

1.2.2

1.2.2.0

A simple library to generate passwords

  Sources   Download

Creative Commons Attribution-ShareAlike 4.0

The Requires

  • php >=7.1

 

The Development Requires

28/07 2017

1.2.1

1.2.1.0

A simple library to generate passwords

  Sources   Download

Creative Commons Attribution-ShareAlike 4.0

The Requires

  • php >=7.0

 

The Development Requires

30/03 2017

1.2.0

1.2.0.0

A simple library to generate passwords

  Sources   Download

Creative Commons Attribution-ShareAlike 4.0

The Requires

  • php >=7.0

 

The Development Requires

02/03 2017

1.1.0

1.1.0.0

A simple library to generate passwords

  Sources   Download

Creative Commons Attribution-ShareAlike 4.0

The Requires

  • php >=7.0

 

The Development Requires

28/01 2017

1.0.0

1.0.0.0

a simple library to generate passwords

  Sources   Download

Creative Commons Attribution-ShareAlike 4.0

The Requires

  • php >=7.0

 

The Development Requires