PHP Classes

Riddler: Generate passwords according to given criteria

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 106 All time: 9,705 This week: 673Up
Version License PHP version Categories
riddler 1.0.0The PHP License5PHP 5, Text processing, Security
Description 

Author

This class can generate passwords according to given criteria.

It can generate text strings that may vary in different aspects using specific classes that define criteria for the characters of the text string.

Currently it provides classes for defining criteria that can be of type contracts, dictionaries, formats, and occurrences.

Picture of DeGraciaMathieu
  Performance   Level  
Name: DeGraciaMathieu <contact>
Classes: 21 packages by
Country: France France
Age: ???
All time rank: 289780 in France France
Week rank: 21 Up2 in France France Up
Innovation award
Innovation award
Nominee: 15x

Winner: 2x

Recommendations

PHP API Key Generator
A random API key generator to server as access restriction to AP

generate unique id by 11 digi number
generate unique id

Documentation

<p align="center"> <img src="https://i62.servimg.com/u/f62/11/13/61/32/riddle10.png" width="300"> </p> <p align="center"> <a href="https://www.codacy.com/app/DeGraciaMathieu/Riddler?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=DeGraciaMathieu/Riddler&amp;utm_campaign=Badge_Grade"><img src="https://api.codacy.com/project/badge/Grade/d662a4fa526a4a709d3ad1991cba2533" alt="Codacy Badge"></a> <a href="https://scrutinizer-ci.com/g/degraciamathieu/riddler/?branch=master"><img src="https://scrutinizer-ci.com/g/DeGraciaMathieu/Riddler/badges/quality-score.png?b=master" alt="Scrutinizer Code Quality"></a> <a href="https://scrutinizer-ci.com/g/DeGraciaMathieu/Riddler/build-status/master"><img src="https://scrutinizer-ci.com/g/DeGraciaMathieu/Riddler/badges/build.png?b=master" alt="Build Status"></a> <a href="https://scrutinizer-ci.com/g/DeGraciaMathieu/Riddler/?branch=master"><img src="https://scrutinizer-ci.com/g/DeGraciaMathieu/Riddler/badges/coverage.png?b=master" alt="Code Coverage"></a> <a href="https://packagist.org/packages/degraciamathieu/riddler"><img src="https://img.shields.io/packagist/v/degraciamathieu/riddler.svg?style=flat-square" alt="Latest Version on Packagist"></a> </p>

DeGraciaMathieu/Riddler

Password generator service

Installation

Run in console below command to download package to your project:

composer require degraciamathieu/riddler

Usage

A password is a set of one or more criteria composed of a dictionary and an occurrence.

The available dictionaries are : * AccentedLetter * AccentedUppercaseLetter * Digit * Letter * SpecialCharacter * UppercaseLetter

Available occurrences : * Strict * Between

require 'vendor\autoload.php';

use DeGraciaMathieu\Riddler\Password;
use DeGraciaMathieu\Riddler\Dictionaries;
use DeGraciaMathieu\Riddler\Occurrences;

$password = new Password();
$password->addCriteria(new Dictionaries\Digit(), new Occurrences\Strict(5));
$password->addCriteria(new Dictionaries\Letter(), new Occurrences\Between(3, 6));
$password->generate();

To build passwords faster, it is possible to use a set of prescinded criteria using the formats.

Available formats : * LongDigit * MixedComplex * MixedStrong * SmallAlphanumeric * StrongAlphanumeric

require 'vendor\autoload.php';

use DeGraciaMathieu\Riddler\Password;
use DeGraciaMathieu\Riddler\Formats;

$password = new Password();
$password->addFormat(new Formats\StrongAlphanumeric());
$password->generate();

It is possible to create its own class format implementing the interface DeGraciaMathieu\Riddler\Contracts\Format

Examples

Classics

$password = new Password;
$password->addCriteria(new Digit(), new Strict(10));
$password->generate(); // "4731412968"

$password = new Password;
$password->addCriteria(new Letter(), new Strict(20));
$password->generate(); // "tugmdzkgohnnkfrxuqns"

$password = new Password;
$password->addCriteria(new UppercaseLetter(), new Strict(20));
$password->generate(); // "JDXIRCEBWDPZLCWIJNYZ"

$password = new Password;
$password->addCriteria(new UppercaseLetter(), new Between(5, 7));
$password->addCriteria(new Letter(), new Between(5, 7));
$password->generate(); // "xIXPstuqTZmb"

$password = new Password;
$password->addCriteria(new SpecialCharacter(), new Strict(15));
$password->generate(); // "#^_=%§][:@_]^%="

$password = new Password;
$password->addCriteria(new AccentedLetter(), new Strict(15));
$password->generate(); // "üãöîâüîüûàóäùéú"

$password = new Password;
$password->addCriteria(new AccentedUppercaseLetter(), new Strict(15));
$password->generate(); // "ÂÚÏÝÒÌÀÂÜÝÛËÍÊÌ"

$password = new Password;
$password->addCriteria(new Digit(), new Strict(5));
$password->addCriteria(new Letter(), new Strict(5));
$password->addCriteria(new SpecialCharacter(), new Between(5, 10));
$password->generate(); // "!186u;n&~§3r7hb|~?"

$password = new Password;
$password->addCriteria(new Digit(), new Between(5, 7));
$password->addCriteria(new Letter(), new Between(5, 7));
$password->addCriteria(new UppercaseLetter(), new Between(5, 7));
$password->addCriteria(new AccentedLetter(), new Between(5, 7));
$password->addCriteria(new SpecialCharacter(), new Between(5, 7));
$password->generate(); // "uELòp§iO°L§7b~â]3ûë7èm96A"

Formats

$password = new Password();
$password->addFormat(new Formats\LongDigit());
$password->generate(); // "075197457894437657185665450123"

$password = new Password();
$password->addFormat(new Formats\SmallAlphanumeric());
$password->generate(); // "mA5M6ap167gRTeE"

$password = new Password();
$password->addFormat(new Formats\StrongAlphanumeric());
$password->generate(); // "492OHwdJEdDT5Lb89zhY9c26j4XhmX"

$password = new Password();
$password->addFormat(new Formats\MixedStrong());
$password->generate(); // "41súdSXWHV65k2G0lr0õèñzåY"

$password = new Password();
$password->addFormat(new Formats\MixedComplex());
$password->generate(); // "Äûc[%ÀÁkWï_1V8k3uw*3§ÔEaAÍ+5§ôåûWYI6äÕ7"

  Files folder image Files (25)  
File Role Description
Files folder imagesrc (3 files, 4 directories)
Files folder imagetests (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (25)  /  src  
File Role Description
Files folder imageContracts (3 files)
Files folder imageDictionaries (6 files)
Files folder imageFormats (5 files)
Files folder imageOccurrences (3 files)
  Plain text file Criteria.php Class Class source
  Plain text file Manager.php Class Class source
  Plain text file Password.php Class Class source

  Files folder image Files (25)  /  src  /  Contracts  
File Role Description
  Plain text file Dictionary.php Class Class source
  Plain text file Format.php Class Class source
  Plain text file Occurrence.php Class Class source

  Files folder image Files (25)  /  src  /  Dictionaries  
File Role Description
  Plain text file AccentedLetter.php Class Class source
  Plain text file AccentedUppercaseLetter.php Class Class source
  Plain text file Digit.php Class Class source
  Plain text file Letter.php Class Class source
  Plain text file SpecialCharacter.php Class Class source
  Plain text file UppercaseLetter.php Class Class source

  Files folder image Files (25)  /  src  /  Formats  
File Role Description
  Plain text file LongDigit.php Class Class source
  Plain text file MixedComplex.php Class Class source
  Plain text file MixedStrong.php Class Class source
  Plain text file SmallAlphanumeric.php Class Class source
  Plain text file StrongAlphanumeric.php Class Class source

  Files folder image Files (25)  /  src  /  Occurrences  
File Role Description
  Plain text file BaseOccurrence.php Class Class source
  Plain text file Between.php Class Class source
  Plain text file Strict.php Class Class source

  Files folder image Files (25)  /  tests  
File Role Description
  Plain text file Test.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:106
This week:0
All time:9,705
This week:673Up