martbock/laravel-diceware

Diceware Passphrase Generator for Laravel

v2.1.0 2023-03-05 10:56 UTC

README

Latest Version on Packagist StyleCI Maintainability Code Coverage Build Status

This package makes it easy to generate passphrases that are both secure and easy to remember.

It uses Diceware wordlists and is fully configurable to your needs.

Usage

It's a breeze to generate a random diceware passphrase, simply use the Facade like this:

$passphrase = Diceware::generate();

// returns 'unwind-cosmic-entryway-MAGNETIC-stardust-ligament'
return $passphrase;

Why use it?

For years, we trained everyone to use passwords that are hard for humans to remember but easy for machines to guess. If you don't want to frustrate your users, you should consider using something like Diceware to generate passphrases that are easier to remember and to typewrite.

Perhaps, the problem is best explained by this famous xkcd comic:

xkcd Password Strength Comic

Installation

You can install the package via composer. Next, publish the diceware.php configuration file so can adjust the settings for this package.

composer require martbock/laravel-diceware
php artisan vendor:publish --provider 'Martbock\Diceware\DicewareServiceProvider'

Configuration

You may change the default settings in the diceware.php config file that you can publish to your Laravel config directory after you installed this package. Currently, the following options are supported:

'number_of_words'       => 6,
'separator'             => '-',
'capitalize'            => true,
'add_number'            => false,
'wordlist'              => 'english',
'custom_wordlist_path'  => null,
'number_of_dice'        => 5,

Of course, you can use your own wordlist, just set the custom_wordlist_path accordingly.

License

The PHP implementation is licensed under the MIT license, see LICENSE.md.

The included wordlists have the following licenses:

  • eff.txt is licensed under CC-BY-3.0 by the Electronic Frontier Foundation.
  • english.txt is licensed under CC-BY-3.0 by Arnold G. Reinhold.
  • german.txt is licensed under the GNU General Public License by Benjamin Tenne.