mijatovicmilan/laravel-password-generator

1.0.0 2022-03-11 15:00 UTC

This package is auto-updated.

Last update: 2024-10-11 21:38:09 UTC


README

Installation

You can install the package via composer:

composer require mijatovicmilan/laravel-password-generator

You can publish the config file with:

php artisan vendor:publish --tag="password-generator-config"

This is the contents of the published config file:

return [
    // Minimum password length
    "minimum_password_length" => 6,

    // If password length is not passed we will use this length instead
    "default_password_length" => 6,

    // If password strength is not passed we will use this strength instead
    "default_password_strength" => 2,
];

Usage

GeneratePassword action accept 2 parameters, both parameters are optinal. First parameter is password length, if left empty we will use length defined in config. Second parameter is password strength, if left empty we will use strength defined in config file.

use MijatovicMilan\LaravelPasswordGenerator\Actions\GeneratePassword;

$password = (new GeneratePassword)(12, 2);

or

use MijatovicMilan\LaravelPasswordGenerator\Actions\GeneratePassword;

public function something(GeneratePassword $generatePassword) {
    $password = $generatePassword();
}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

License

The MIT License (MIT). Please see License File for more information.