{"id":13593542,"url":"https://github.com/hackzilla/password-generator","last_synced_at":"2025-06-12T20:35:10.106Z","repository":{"id":15971049,"uuid":"18713844","full_name":"hackzilla/password-generator","owner":"hackzilla","description":"PHP Library to generate random passwords","archived":false,"fork":false,"pushed_at":"2024-09-01T13:59:47.000Z","size":222,"stargazers_count":297,"open_issues_count":5,"forks_count":37,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-22T18:17:25.681Z","etag":null,"topics":["composer","password-generator","php","php-library","php8"],"latest_commit_sha":null,"homepage":"https://hackzilla.org","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hackzilla.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-04-12T20:27:49.000Z","updated_at":"2025-04-19T06:29:14.000Z","dependencies_parsed_at":"2024-06-18T11:07:55.366Z","dependency_job_id":"14c11d0d-c0ff-4eb6-aaab-6ab2fcb7ea14","html_url":"https://github.com/hackzilla/password-generator","commit_stats":{"total_commits":181,"total_committers":11,"mean_commits":"16.454545454545453","dds":0.07182320441988954,"last_synced_commit":"743c8493d2c33ebf9496a1c3c248efeb568fe134"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/hackzilla/password-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackzilla%2Fpassword-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackzilla%2Fpassword-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackzilla%2Fpassword-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackzilla%2Fpassword-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hackzilla","download_url":"https://codeload.github.com/hackzilla/password-generator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackzilla%2Fpassword-generator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259522455,"owners_count":22870469,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["composer","password-generator","php","php-library","php8"],"created_at":"2024-08-01T16:01:21.388Z","updated_at":"2025-06-12T20:35:10.075Z","avatar_url":"https://github.com/hackzilla.png","language":"PHP","readme":"# Password Generator Library\n\nSimple library for generating random passwords.\n\n[![Latest Stable Version](https://poser.pugx.org/hackzilla/password-generator/v/stable.svg)](https://packagist.org/packages/hackzilla/password-generator)\n[![Total Downloads](https://poser.pugx.org/hackzilla/password-generator/downloads.svg)](https://packagist.org/packages/hackzilla/password-generator)\n[![Latest Unstable Version](https://poser.pugx.org/hackzilla/password-generator/v/unstable.svg)](https://packagist.org/packages/hackzilla/password-generator)\n[![License](https://poser.pugx.org/hackzilla/password-generator/license.svg)](https://packagist.org/packages/hackzilla/password-generator)\n\n\n## Requirements\n\n* PHP \u003e= 8.0\n* ext-mbstring\n\n## Installation\n\nInstall Composer\n\n```\ncurl -sS https://getcomposer.org/installer | php\nmv composer.phar /usr/local/bin/composer\n```\n\nNow tell composer to download the library by running the command:\n\n``` bash\n$ composer require hackzilla/password-generator\n```\n\nComposer will add the library to your composer.json file and install it into your project's `vendor/hackzilla` directory.\n\n\n## Simple Usage\n\n```php\nuse Hackzilla\\PasswordGenerator\\Generator\\ComputerPasswordGenerator;\n\n$generator = new ComputerPasswordGenerator();\n\n$generator\n  -\u003esetOptionValue(ComputerPasswordGenerator::OPTION_UPPER_CASE, true)\n  -\u003esetOptionValue(ComputerPasswordGenerator::OPTION_LOWER_CASE, true)\n  -\u003esetOptionValue(ComputerPasswordGenerator::OPTION_NUMBERS, true)\n  -\u003esetOptionValue(ComputerPasswordGenerator::OPTION_SYMBOLS, false)\n;\n\n$password = $generator-\u003egeneratePassword();\n```\n\n\n## More Passwords Usage\n\nIf you want to generate 10 passwords that are 12 characters long.\n\n```php\nuse Hackzilla\\PasswordGenerator\\Generator\\ComputerPasswordGenerator;\n\n$generator = new ComputerPasswordGenerator();\n\n$generator\n  -\u003esetUppercase()\n  -\u003esetLowercase()\n  -\u003esetNumbers()\n  -\u003esetSymbols(false)\n  -\u003esetLength(12);\n\n$password = $generator-\u003egeneratePasswords(10);\n```\n\n## Hybrid Password Generator Usage\n\n```php\nuse Hackzilla\\PasswordGenerator\\Generator\\HybridPasswordGenerator;\n\n$generator = new HybridPasswordGenerator();\n\n$generator\n  -\u003esetUppercase()\n  -\u003esetLowercase()\n  -\u003esetNumbers()\n  -\u003esetSymbols(false)\n  -\u003esetSegmentLength(3)\n  -\u003esetSegmentCount(4)\n  -\u003esetSegmentSeparator('-');\n\n$password = $generator-\u003egeneratePasswords(10);\n```\n\nIf you can think of a better name for this password generator then let me know.\n\nThe segment separator will be remove from the possible characters.\n\n\n## Human Password Generator Usage\n\n```php\nuse Hackzilla\\PasswordGenerator\\Generator\\HumanPasswordGenerator;\n\n$generator = new HumanPasswordGenerator();\n\n$generator\n  -\u003esetWordList('/usr/share/dict/words')\n  -\u003esetWordCount(3)\n  -\u003esetWordSeparator('-');\n\n$password = $generator-\u003egeneratePasswords(10);\n```\n\n## Requirement Password Generator Usage\n\n```php\nuse Hackzilla\\PasswordGenerator\\Generator\\RequirementPasswordGenerator;\n\n$generator = new RequirementPasswordGenerator();\n\n$generator\n  -\u003esetLength(16)\n  -\u003esetOptionValue(RequirementPasswordGenerator::OPTION_UPPER_CASE, true)\n  -\u003esetOptionValue(RequirementPasswordGenerator::OPTION_LOWER_CASE, true)\n  -\u003esetOptionValue(RequirementPasswordGenerator::OPTION_NUMBERS, true)\n  -\u003esetOptionValue(RequirementPasswordGenerator::OPTION_SYMBOLS, true)\n  -\u003esetMinimumCount(RequirementPasswordGenerator::OPTION_UPPER_CASE, 2)\n  -\u003esetMinimumCount(RequirementPasswordGenerator::OPTION_LOWER_CASE, 2)\n  -\u003esetMinimumCount(RequirementPasswordGenerator::OPTION_NUMBERS, 2)\n  -\u003esetMinimumCount(RequirementPasswordGenerator::OPTION_SYMBOLS, 2)\n  -\u003esetMaximumCount(RequirementPasswordGenerator::OPTION_UPPER_CASE, 8)\n  -\u003esetMaximumCount(RequirementPasswordGenerator::OPTION_LOWER_CASE, 8)\n  -\u003esetMaximumCount(RequirementPasswordGenerator::OPTION_NUMBERS, 8)\n  -\u003esetMaximumCount(RequirementPasswordGenerator::OPTION_SYMBOLS, 8)\n;\n\n$password = $generator-\u003egeneratePassword();\n```\n\nA limit can be removed by passing ```null```\n\n```php\n$generator\n  -\u003esetMinimumCount(RequirementPasswordGenerator::OPTION_UPPER_CASE, null)\n  -\u003esetMaximumCount(RequirementPasswordGenerator::OPTION_UPPER_CASE, null)\n;\n```\n\nWhen setting the minimum and maximum values, be careful of unachievable settings.\n\nFor example the following will end up in an infinite loop.\n```php\n$generator\n  -\u003esetLength(4)\n  -\u003esetOptionValue(RequirementPasswordGenerator::OPTION_UPPER_CASE, true)\n  -\u003esetOptionValue(RequirementPasswordGenerator::OPTION_LOWER_CASE, false)\n  -\u003esetMinimumCount(RequirementPasswordGenerator::OPTION_UPPER_CASE, 5)\n  -\u003esetMaximumCount(RequirementPasswordGenerator::OPTION_LOWER_CASE, 1)\n;\n```\n\nFor the moment you can call ```$generator-\u003evalidLimits()``` to test whether the counts will cause problems.\nIf the method returns true, then you can proceed. If false, then generatePassword() will likely cause an infinite loop.\n\n## Example Implementations\n\n* Password Generator App [https://github.com/hackzilla/password-generator-app]\n* Password Generator Bundle [https://github.com/hackzilla/password-generator-bundle]\n\n## Random Note\n\nSince 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+\n\n## Contributions and Issues\nSee all contributors on [GitHub](https://github.com/hackzilla/password-generator/graphs/contributors).\n\nPlease report issues using GitHub's issue tracker: [GitHub Repo](https://github.com/hackzilla/password-generator)\n\nIf you find this project useful, consider [buying me a coffee](https://www.buymeacoffee.com/hackzilla).\n\n## License\n\nThis bundle is released under the MIT license. See the [LICENSE](https://github.com/hackzilla/password-generator/blob/main/LICENSE) file for details.\n","funding_links":["https://www.buymeacoffee.com/hackzilla"],"categories":["PHP","目录","Table of Contents","密码 Passwords"],"sub_categories":["密码 Passwords","Passwords"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhackzilla%2Fpassword-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhackzilla%2Fpassword-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhackzilla%2Fpassword-generator/lists"}