2017 © Pedro Peláez
 

library component-password

PHP password library.

image

eureka/component-password

PHP password library.

  • Monday, July 9, 2018
  • by velkuns
  • Repository
  • 1 Watchers
  • 0 Stars
  • 60 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

component-password

Current version Supported PHP version CI Quality Gate Status Coverage, (*1)

Generate, hash & verify secure password., (*2)

Usage

Composer

composer require "eureka/component-password"

Password Generator

<?php

use Eureka\Component\Password\PasswordGenerator;
use Eureka\Component\Password\StringGenerator;

//~ Use service generator
$length  = 16;  // default
$alpha   = 0.6; // default
$numeric = 0.2; // default
$special = 0.2; // default

$generator = new PasswordGenerator(
    new StringGenerator()
);

$password = $generator->generate($length, $alpha, $numeric, $special);

echo $password->getPlain() . PHP_EOL;
echo $password->getHash() . PHP_EOL;

Password

<?php

use Eureka\Component\Password\Password;

//~ Just define password
$password = new Password('mySecretPassword');

echo $password->getHash() . PHP_EOL;
echo $password->getPlain() . PHP_EOL;

PasswordChecker

<?php

use Eureka\Component\Password\PasswordChecker;

//~ Just define password
$passwordChecker = new PasswordChecker();

$passwordPlain = 'mypassword'; // From login form 
$passwordHash  = '...';        // Retrieved from db for example
echo 'Is valid password: ' . $passwordChecker->verify($passwordPlain, $passwordHash) . PHP_EOL;

Script - Password Generator

vendor/bin/console password/script/generator --help

will output this:, (*3)


Use : bin/console Eureka\Component\Password\Script\Generator [OPTION]... OPTIONS: -g, --generate Generate password -l ARG, --length=ARG Password length -a ARG, --ratio-alpha=ARG Alphabetic latin characters ratio -n ARG, --ratio-numeric=ARG Numeric characters ratio -o ARG, --ratio-other=ARG Other characters ratio

Contributing

See the CONTRIBUTING file., (*4)

Install / update project

You can install project with the following command:, (*5)

make install

And update with the following command:, (*6)

make update

NB: For the components, the composer.lock file is not committed., (*7)

Testing & CI (Continuous Integration)

Tests

You can run unit tests (with coverage) on your side with following command:, (*8)

make tests

You can run integration tests (without coverage) on your side with following command:, (*9)

make integration

For prettier output (but without coverage), you can use the following command:, (*10)

make testdox # run tests without coverage reports but with prettified output

Code Style

You also can run code style check with following commands:, (*11)

make phpcs

You also can run code style fixes with following commands:, (*12)

make phpcsf

Check for missing explicit dependencies

You can check if any explicit dependency is missing with the following command:, (*13)

make deps

Static Analysis

To perform a static analyze of your code (with phpstan, lvl 9 at default), you can use the following command:, (*14)

make analyse

To ensure you code still compatible with current supported version at Deezer and futures versions of php, you need to run the following commands (both are required for full support):, (*15)

Minimal supported version:, (*16)

make php81compatibility

Maximal supported version:, (*17)

make php83compatibility

CI Simulation

And the last "helper" commands, you can run before commit and push, is:, (*18)

make ci  

License

This project is currently under The MIT License (MIT). See LICENCE file for more information., (*19)

The Versions

09/07 2018

dev-branch_2.x

dev-branch_2.x

PHP password library.

  Sources   Download

MIT

The Requires

 

by Romain Cottard

09/07 2018

2.0.1

2.0.1.0

PHP password library.

  Sources   Download

MIT

The Requires

 

by Romain Cottard

09/10 2016

dev-master

9999999-dev

PHP password library.

  Sources   Download

MIT

by Romain Cottard

09/10 2016

1.0.0

1.0.0.0

PHP password library.

  Sources   Download

MIT

by Romain Cottard