Generates password based on the provided parameters

This extension by default will return 8 characters long password and you can also provide optional parameters to make the password more complex.


Tested with Yii 1.1.10 and 1.1.12. may work on other versions


  • Extract the file under protected/extensions folder.
  • In main.php file:
'components' => array(
    'epassgen' => array(
            'class' => 'ext.epasswordgenerator.EPasswordGenerator',

Default Usage

$passowrd = Yii::app()->epassgen->generate();

Usage with optional parameters

$passowrd = Yii::app()->epassgen->generate(10, 2, 3, 2);


Total 3 comments

#17446 report it
vijay p s at 2014/06/13 06:52am
Default usage

this default usage we can used in the _form.php like this,

"$passowrd = Yii::app()->epassgen->generate();" & $passowrd = Yii::app()->epassgen->generate(10, 2, 3, 2);

$passowrd = Yii::app()->epassgen->generate();
<div class="row">
        <?php echo $form->labelEx($model,'password'); ?>
        <?php echo $form->textField($model,'password',array('size'=>20,'maxlength'=>20, value=$password)); ?>
        <?php echo $form->error($model,'password'); ?>

am using textfield because i want to know the auto generated password for my reference.

#14598 report it
Ibrar Turi at 2013/08/27 02:41am
Thanks for the info :)

For easy to remember passphrase, the 'Diceware component' is a good component to use.

#14597 report it
nineinchnick at 2013/08/27 02:27am

In my usr extension I'm using a diceware passphrase generator, generating passwords using words instead of chars that are supposed to be remembered more easily. Check out the Diceware component.

It's not advertising, just a tip of other methods of generating passwords.

Leave a comment

Please to leave your comment.

Create extension