florianeckerstorfer / passwordplease-php
Requires
- ircmaxell/random-lib: ~1.0
- symfony/console: ~2.5
Requires (Dev)
- kherge/box: ~2.4
- mockery/mockery: ~0.9
- phpunit/phpunit: ~4.2
This package is auto-updated.
Last update: 2024-11-20 10:35:00 UTC
README
=================Password, Please! generates secure passwords in PHP. You can use it as a command line application or as a library in your code.
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:
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 and4
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.