PHPackages                             hackzilla/password-generator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. hackzilla/password-generator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

hackzilla/password-generator
============================

Password Generator Library

1.7.0(1y ago)3035.2M—4%36[5 issues](https://github.com/hackzilla/password-generator/issues)14MITPHPPHP &gt;=8.0

Since Apr 12Pushed 1y ago7 watchersCompare

[ Source](https://github.com/hackzilla/password-generator)[ Packagist](https://packagist.org/packages/hackzilla/password-generator)[ RSS](/packages/hackzilla-password-generator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (35)Used By (14)

Password Generator Library
==========================

[](#password-generator-library)

Simple library for generating random passwords.

[![Latest Stable Version](https://camo.githubusercontent.com/a453439c279375be5668f76016c04613a2be41de49742d89b267de6a1f0af694/68747470733a2f2f706f7365722e707567782e6f72672f6861636b7a696c6c612f70617373776f72642d67656e657261746f722f762f737461626c652e737667)](https://packagist.org/packages/hackzilla/password-generator)[![Total Downloads](https://camo.githubusercontent.com/5fd1929dee90e7f9dacc2eef7234f75dd1aeb8d9b425019701d7db09153a76e3/68747470733a2f2f706f7365722e707567782e6f72672f6861636b7a696c6c612f70617373776f72642d67656e657261746f722f646f776e6c6f6164732e737667)](https://packagist.org/packages/hackzilla/password-generator)[![Latest Unstable Version](https://camo.githubusercontent.com/b18f8b91b4d1139de852bfa1a44818abe257fba115725a5353d3f997ed563634/68747470733a2f2f706f7365722e707567782e6f72672f6861636b7a696c6c612f70617373776f72642d67656e657261746f722f762f756e737461626c652e737667)](https://packagist.org/packages/hackzilla/password-generator)[![License](https://camo.githubusercontent.com/e4afa4ed31cc3028d47780eb6a8cceeafba383c2947e0f451104b53ef546235c/68747470733a2f2f706f7365722e707567782e6f72672f6861636b7a696c6c612f70617373776f72642d67656e657261746f722f6c6963656e73652e737667)](https://packagist.org/packages/hackzilla/password-generator)

Requirements
------------

[](#requirements)

- PHP &gt;= 8.0
- ext-mbstring

Installation
------------

[](#installation)

Install Composer

```
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

```

Now tell composer to download the library by running the command:

```
$ composer require hackzilla/password-generator
```

Composer will add the library to your composer.json file and install it into your project's `vendor/hackzilla` directory.

Simple Usage
------------

[](#simple-usage)

```
use Hackzilla\PasswordGenerator\Generator\ComputerPasswordGenerator;

$generator = new ComputerPasswordGenerator();

$generator
  ->setOptionValue(ComputerPasswordGenerator::OPTION_UPPER_CASE, true)
  ->setOptionValue(ComputerPasswordGenerator::OPTION_LOWER_CASE, true)
  ->setOptionValue(ComputerPasswordGenerator::OPTION_NUMBERS, true)
  ->setOptionValue(ComputerPasswordGenerator::OPTION_SYMBOLS, false)
;

$password = $generator->generatePassword();
```

More Passwords Usage
--------------------

[](#more-passwords-usage)

If you want to generate 10 passwords that are 12 characters long.

```
use Hackzilla\PasswordGenerator\Generator\ComputerPasswordGenerator;

$generator = new ComputerPasswordGenerator();

$generator
  ->setUppercase()
  ->setLowercase()
  ->setNumbers()
  ->setSymbols(false)
  ->setLength(12);

$password = $generator->generatePasswords(10);
```

Hybrid Password Generator Usage
-------------------------------

[](#hybrid-password-generator-usage)

```
use Hackzilla\PasswordGenerator\Generator\HybridPasswordGenerator;

$generator = new HybridPasswordGenerator();

$generator
  ->setUppercase()
  ->setLowercase()
  ->setNumbers()
  ->setSymbols(false)
  ->setSegmentLength(3)
  ->setSegmentCount(4)
  ->setSegmentSeparator('-');

$password = $generator->generatePasswords(10);
```

If you can think of a better name for this password generator then let me know.

The segment separator will be remove from the possible characters.

Human Password Generator Usage
------------------------------

[](#human-password-generator-usage)

```
use Hackzilla\PasswordGenerator\Generator\HumanPasswordGenerator;

$generator = new HumanPasswordGenerator();

$generator
  ->setWordList('/usr/share/dict/words')
  ->setWordCount(3)
  ->setWordSeparator('-');

$password = $generator->generatePasswords(10);
```

Requirement Password Generator Usage
------------------------------------

[](#requirement-password-generator-usage)

```
use Hackzilla\PasswordGenerator\Generator\RequirementPasswordGenerator;

$generator = new RequirementPasswordGenerator();

$generator
  ->setLength(16)
  ->setOptionValue(RequirementPasswordGenerator::OPTION_UPPER_CASE, true)
  ->setOptionValue(RequirementPasswordGenerator::OPTION_LOWER_CASE, true)
  ->setOptionValue(RequirementPasswordGenerator::OPTION_NUMBERS, true)
  ->setOptionValue(RequirementPasswordGenerator::OPTION_SYMBOLS, true)
  ->setMinimumCount(RequirementPasswordGenerator::OPTION_UPPER_CASE, 2)
  ->setMinimumCount(RequirementPasswordGenerator::OPTION_LOWER_CASE, 2)
  ->setMinimumCount(RequirementPasswordGenerator::OPTION_NUMBERS, 2)
  ->setMinimumCount(RequirementPasswordGenerator::OPTION_SYMBOLS, 2)
  ->setMaximumCount(RequirementPasswordGenerator::OPTION_UPPER_CASE, 8)
  ->setMaximumCount(RequirementPasswordGenerator::OPTION_LOWER_CASE, 8)
  ->setMaximumCount(RequirementPasswordGenerator::OPTION_NUMBERS, 8)
  ->setMaximumCount(RequirementPasswordGenerator::OPTION_SYMBOLS, 8)
;

$password = $generator->generatePassword();
```

A limit can be removed by passing `null`

```
$generator
  ->setMinimumCount(RequirementPasswordGenerator::OPTION_UPPER_CASE, null)
  ->setMaximumCount(RequirementPasswordGenerator::OPTION_UPPER_CASE, null)
;
```

When setting the minimum and maximum values, be careful of unachievable settings.

For example the following will end up in an infinite loop.

```
$generator
  ->setLength(4)
  ->setOptionValue(RequirementPasswordGenerator::OPTION_UPPER_CASE, true)
  ->setOptionValue(RequirementPasswordGenerator::OPTION_LOWER_CASE, false)
  ->setMinimumCount(RequirementPasswordGenerator::OPTION_UPPER_CASE, 5)
  ->setMaximumCount(RequirementPasswordGenerator::OPTION_LOWER_CASE, 1)
;
```

For the moment you can call `$generator->validLimits()` to test whether the counts will cause problems. If the method returns true, then you can proceed. If false, then generatePassword() will likely cause an infinite loop.

Example Implementations
-----------------------

[](#example-implementations)

- Password Generator App \[\]
- Password Generator Bundle \[\]

Random Note
-----------

[](#random-note)

Since version 1.5.0, the library depends on the presence of [random\_int](http://www.php.net/random_int) which is found in PHP 7.0+

Contributions and Issues
------------------------

[](#contributions-and-issues)

See all contributors on [GitHub](https://github.com/hackzilla/password-generator/graphs/contributors).

Please report issues using GitHub's issue tracker: [GitHub Repo](https://github.com/hackzilla/password-generator)

If you find this project useful, consider [buying me a coffee](https://www.buymeacoffee.com/hackzilla).

License
-------

[](#license)

This bundle is released under the MIT license. See the [LICENSE](https://github.com/hackzilla/password-generator/blob/main/LICENSE) file for details.

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity63

Solid adoption and visibility

Community34

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 93.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~126 days

Recently: every ~488 days

Total

31

Last Release

633d ago

Major Versions

0.8 → 1.0-alpha2015-01-01

1.6.0 → 2.x-dev2021-04-14

PHP version history (4 changes)0.1PHP &gt;=5.3.2

1.5.0PHP &gt;=7.1.0

2.x-devPHP &gt;=7.4.0

1.7.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/c8428121f534a487f9db5fd65e4e38fcb6861491b41ef312a6555725d25ab3fd?d=identicon)[hackzilla](/maintainers/hackzilla)

---

Top Contributors

[![hackzilla](https://avatars.githubusercontent.com/u/1474182?v=4)](https://github.com/hackzilla "hackzilla (190 commits)")[![soullivaneuh](https://avatars.githubusercontent.com/u/1698357?v=4)](https://github.com/soullivaneuh "soullivaneuh (2 commits)")[![OskarStark](https://avatars.githubusercontent.com/u/995707?v=4)](https://github.com/OskarStark "OskarStark (2 commits)")[![tjasek](https://avatars.githubusercontent.com/u/2591771?v=4)](https://github.com/tjasek "tjasek (2 commits)")[![elwin1234](https://avatars.githubusercontent.com/u/3977962?v=4)](https://github.com/elwin1234 "elwin1234 (2 commits)")[![DavidGoodwin](https://avatars.githubusercontent.com/u/203929?v=4)](https://github.com/DavidGoodwin "DavidGoodwin (1 commits)")[![WouterSioen](https://avatars.githubusercontent.com/u/1398405?v=4)](https://github.com/WouterSioen "WouterSioen (1 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")[![Philzen](https://avatars.githubusercontent.com/u/1634615?v=4)](https://github.com/Philzen "Philzen (1 commits)")[![SunMar](https://avatars.githubusercontent.com/u/8324268?v=4)](https://github.com/SunMar "SunMar (1 commits)")[![turboezh](https://avatars.githubusercontent.com/u/1132740?v=4)](https://github.com/turboezh "turboezh (1 commits)")

---

Tags

composerpassword-generatorphpphp-libraryphp8

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hackzilla-password-generator/health.svg)

```
[![Health](https://phpackages.com/badges/hackzilla-password-generator/health.svg)](https://phpackages.com/packages/hackzilla-password-generator)
```

###  Alternatives

[rezzza/ruler-bundle

A simple stateless production rules engine for Symfony 2.

2612.8k](/packages/rezzza-ruler-bundle)[richardhj/contao-ajax_reload_element

AjaxReloadElement for Contao OpenSource CMS

144.2k](/packages/richardhj-contao-ajax-reload-element)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
