{"id":36251527,"url":"https://github.com/ohchiko/randomizer","last_synced_at":"2026-01-11T07:00:18.010Z","repository":{"id":57030524,"uuid":"207720237","full_name":"ohchiko/randomizer","owner":"ohchiko","description":"A php helper to generate random text. Initial purpose is for user password.","archived":false,"fork":false,"pushed_at":"2019-09-20T04:23:27.000Z","size":140,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-26T18:25:51.144Z","etag":null,"topics":["password-generator","php","php-helper","randomizer"],"latest_commit_sha":null,"homepage":"","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/ohchiko.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-11T04:04:50.000Z","updated_at":"2019-09-20T07:00:17.000Z","dependencies_parsed_at":"2022-08-23T17:30:13.742Z","dependency_job_id":null,"html_url":"https://github.com/ohchiko/randomizer","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ohchiko/randomizer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohchiko%2Frandomizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohchiko%2Frandomizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohchiko%2Frandomizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohchiko%2Frandomizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ohchiko","download_url":"https://codeload.github.com/ohchiko/randomizer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohchiko%2Frandomizer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28296941,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T04:44:51.577Z","status":"ssl_error","status_checked_at":"2026-01-11T04:44:44.232Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["password-generator","php","php-helper","randomizer"],"created_at":"2026-01-11T07:00:15.628Z","updated_at":"2026-01-11T07:00:17.936Z","avatar_url":"https://github.com/ohchiko.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Randomizer\n\nRandomizer is a php helper that helps your application to generate a random string.\n\nThis package is initially comes from an idea to generate a user's password.\n\n## Installation\n\nSimply add the package to your `composer.json` file and run `composer update`.\n\n```\n\"ohchiko/randomizer\": \"^0.1.0\"\n```\n\n## Usage\n\nTo generate a random string, simply add below line to your code.\n\n```php\n$random = Randomizer::generate();\n```\n\nIt will return a string containing random words concatenated with random punctutations. Below is the example result.\n\n```php\nstring(21) \"kerikilLajuLiontin*!%\"    // Using default language (id)\n```\n\nIf you want to change the amount of words and/or punctuations in the result string, you may supply the amount in the method.\n\n```php\nRandomizer::generate(1, 3);    // returns something like: string(11) \"sekarang(@!\"\nRandomizer::generate(3, 1);    // returns something like: string(11) \"batuPesawatSekolah\u0026\"\n```\n\n### How It Works\n\nRandomizer is generating a string which contains random words and random punctuations.\n\nThe words and punctuations are taken from a set. There are `wordset` and `punctset` which stores a list of words and punctuations.\n\nBy default, `wordset` are taken from one of [wordset files](resources/wordsets) which identified by the language used. And `punctset` is taken from  an array of punctuations.\n\nFor example, the current available languages are: `id` and `en`, and the default language used is `id`. The wordset file for those languages are: `id_wordset` and `en_wordset`. So, when `generate` method called, it will take a random word(s) from `id_wordset` file because the language used is `id`.\n\nThe amount of words and punctuations to be taken is identified by the `generate` method. The default value for both words and punctuations amount is `3`. See [Available Methods section](#available-methods) for detail.\n\nYou can change the language by calling the `setLanguage` method before the `generate` method. The argument supplied can be the language constants (which currently are `LANG_ID` and `LANG_EN`) or the language code (ex. `en`).\n\n```php\nRandomizer::setLanguage(Randomizer::LANG_EN);    // or Randomizer::setLanguge('en');\nRandomizer::generate();\n```\n\nIf you prefered using your own wordset and/or punctset, you can tell Randomizer to use that instead by calling the `setCustomWordset` and/or `setCustomPunctset` method.\n```php\nRandomizer::setCustomWordset([\"english\", \"okay\", \"airplane\", \"sky\", \"eyeglasses\", \"noise\"]);\nRandomizer::setCustomPunctset([\";\", \"\u003e\", \"=\", \"?\"]);\n```\n\nAfter that, you can check the customized wordset and punctset by calling `getCustomWordset` and/or `getCustomPunctset` method.\n\n### Available Methods\n\nBesides the main method `generate`, there also a number of other methods available.\n\n```php\nRandomizer::generate(int $wordCount = 3, int $punctCount = 3): string   // Generate a string containing random words and punctuations.\nRandomizer::setLanguage(string $language): void                         // Sets the wordset language to randomized. Only supported languages.\nRandomizer::getLanguage(): array                                        // Gets the current wordset language.\nRandomizer::getAvailableLanguages(): array                              // Gets the current supported languages.\nRandomizer::setCustomWordset(array $wordset): void                      // Sets a custom wordset to be randomized.\nRandomizer::getCustomWordset(): ?array                                  // Gets a list of words of the current customized wordset.\nRandomizer::getDefaultWordset(): array                                  // Gets a list of words of the default wordset. Warning: this method may returns a huge number of array members.\nRandomizer::setCustomPunctset(array $punctset): void                    // Sets a custom punctset to be randomized.\nRandomizer::getCustomPunctset(): ?array                                 // Gets a list of current customized punctset. Returns null if none.\nRandomizer::getDefaultPunctset(): array                                 // Gets a list of punctuations of the default punctset.\n```\n\n### Available Language Constants\n\n```php\nRandomizer::LANG_ID\nRandomizer::LANG_EN\n```\n\nThe language constants are hardcoded, so in case to add a new wordset language, I need to update the code to add that language constant.\n\n### Testing\n\nYou can use [phpunit](https://phpunit.de/) from the package root to run the test file.\n\n```sh\nvendor/bin/phpunit tests/\n```\n\n## Support\n\nIf you ever encountered any issues while using this package, you may create a new issue report. If you have any idea on supporting this package (it may be a new wordsets, bug fixes, new feature, etc.), you may create a pull request and I will review it before it can be merged.\n\nPlease remember that this package is comes from an idea of creating a random user's password, so this package may not lead to what it is should be. This package soon may be a real *randomizer*, so please support me. :)\n\n## License\n\nThe MIT License (MIT). Please see [LICENSE](LICENSE) file for more information.\n\n## Credits\n\n- [dbrw](https://github.com/dbrw): Full support on this package\n- [sastrawi/sastrawi](https://github.com/sastrawi/sastrawi): Indonesian word list\n- [paritytech/wordlist](https://github.com/paritytech/wordlist): English word list\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fohchiko%2Frandomizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fohchiko%2Frandomizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fohchiko%2Frandomizer/lists"}