Skip to content
Password, Please! generates secure passwords in PHP. You can use it as a command line application or as a library in your code.
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
src
tests
.gitignore
.travis.yml
LICENSE
README.md
box.json
composer.json
phpunit.xml.dist

README.md

Password Please

=================

Password, Please! generates secure passwords in PHP. You can use it as a command line application or as a library in your code.

Build Status

Command Line Application

Downloading the PHAR archive from the releases page page is the easiest way to get the command line application. The other way is to clone this repository and execute the bin/password-please.php file.

$ git clone https://github.com/florianeckerstorfer/passwordplease-php
$ cd password-please-php
$ php bin/password-please.php gen

Usage

If you call the binary without any arguments you will get a password of length 20 with lower and upper case letters, numbers and special characters. You can change both the length and the complexity.

$ php password-please.phar gen --length=30 --complexity=3

The length must be greather than 0 and complexity must be a value between 1 (very high complexity) and 4 (low complexity). If you're a hasty person, you can use the shorter aliases for the options:

$ php password-please.phar gen -l 30 -c 3

Instead of using the numeric identifier for the complexity, you can also use a high-level string description of the complexity. The following table details the available complexities, the characters used in it and the high-level names:

Complexity Level Alias Characters
VERY_HIGH 1 veryhigh, harder a-zA-Z0-9,;.:-_+*#!()=?%&@$"'
HIGH 2 high, hard a-zA-Z0-9
MEDIUM 3 medium, normal a-zA-Z
LOW 4 low, easy a-z

Library

If you want to use Password, Please! in your code you can add the library to your dependencies using Composer.

$ composer require florianeckerstorfer/passwordplease-php:@stable

Tip: You should replace @stable with a specific version from the releases page.

Usage

Password, Please! depends on ircmaxell/random-lib to generate passwords and you need to pass an instance of \RandomLib\Generator to the constructor.

use Fe\PasswordPlease\PasswordPlease;

$factory = new \RandomLib\Factory;
$generator = $factory->getGenerator(new \SecurityLib\Strength(\SecurityLib\Strength::MEDIUM));

$pp = new PasswordPlease($generator);
$password = $pp->generatePassword(30, PasswordPlease::COMPLEXITY_HIGH);

Change Log

Version 0.2 (4 October 2014)

  • Add string alias for complexities
  • Change order of complexities, 1 is now very high and 4 is low

Version 0.1 (3 September 2014)

  • Initial release

Author

Developed by Florian Eckerstorfer in Vienna, Europe.

License

The MIT license applies to florianeckerstorfer/passwordplease-php. For the full copyright and license information, please view the LICENSE file distributed with this source code.

You can’t perform that action at this time.