{"id":17061793,"url":"https://github.com/phlak/strgen","last_synced_at":"2025-07-22T10:37:20.619Z","repository":{"id":16688834,"uuid":"19445250","full_name":"PHLAK/StrGen","owner":"PHLAK","description":"PHP library for simple, secure random string generation (e.g. - passwords / salts).","archived":false,"fork":false,"pushed_at":"2023-07-01T11:35:56.000Z","size":160,"stargazers_count":22,"open_issues_count":1,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-23T05:06:50.351Z","etag":null,"topics":["php","php-library","random-string"],"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/PHLAK.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"zenodo":null},"funding":{"github":"PHLAK","patreon":"PHLAK","custom":"https://paypal.me/ChrisKankiewicz"}},"created_at":"2014-05-05T05:47:16.000Z","updated_at":"2025-02-20T07:36:42.000Z","dependencies_parsed_at":"2025-04-12T18:15:08.073Z","dependency_job_id":"eb7de9ec-a312-46c9-b81e-b65100e6cbf4","html_url":"https://github.com/PHLAK/StrGen","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/PHLAK/StrGen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHLAK%2FStrGen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHLAK%2FStrGen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHLAK%2FStrGen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHLAK%2FStrGen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PHLAK","download_url":"https://codeload.github.com/PHLAK/StrGen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHLAK%2FStrGen/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266477152,"owners_count":23935390,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"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":["php","php-library","random-string"],"created_at":"2024-10-14T10:48:12.479Z","updated_at":"2025-07-22T10:37:20.610Z","avatar_url":"https://github.com/PHLAK.png","language":"PHP","funding_links":["https://github.com/sponsors/PHLAK","https://patreon.com/PHLAK","https://paypal.me/ChrisKankiewicz"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"strgen.png\" alt=\"StrGen\" width=\"50%\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/PHLAK/StrGen/discussions\"\u003e\u003cimg src=\"https://img.shields.io/badge/Join_the-Community-7b16ff.svg?style=for-the-badge\" alt=\"Join the Community\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/users/PHLAK/sponsorship\"\u003e\u003cimg src=\"https://img.shields.io/badge/Become_a-Sponsor-cc4195.svg?style=for-the-badge\" alt=\"Become a Sponsor\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://paypal.me/ChrisKankiewicz\"\u003e\u003cimg src=\"https://img.shields.io/badge/Make_a-Donation-006bb6.svg?style=for-the-badge\" alt=\"One-time Donation\"\u003e\u003c/a\u003e\n    \u003cbr\u003e\n    \u003ca href=\"https://packagist.org/packages/phlak/strgen\"\u003e\u003cimg src=\"https://img.shields.io/packagist/v/phlak/strgen.svg?style=flat-square\" alt=\"Latest Stable Version\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/phlak/strgen\"\u003e\u003cimg src=\"https://img.shields.io/packagist/dt/phlak/strgen.svg?style=flat-square\" alt=\"Total Downloads\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/phlak/strgen\"\u003e\u003cimg src=\"https://img.shields.io/packagist/l/phlak/strgen.svg?style=flat-square\" alt=\"License\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/PHLAK/StrGen/actions\" alt=\"Build Status\"\u003e\u003cimg src=\"https://img.shields.io/github/checks-status/PHLAK/StrGen/master?style=flat-square\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    PHP library for simple secure random string generation (e.g. - passwords / salts)\n    \u003cbr\u003e\n    Created by \u003ca href=\"https://www.ChrisKankiewicz.com\"\u003eChris Kankiewicz\u003c/a\u003e (\u003ca href=\"https://twitter.com/PHLAK\"\u003e@PHLAK\u003c/a\u003e)\n\u003c/p\u003e\n\n---\n\nRequirements\n------------\n\n  - [PHP](https://php.net) \u003e= 7.2\n\nInstall with Composer\n---------------------\n\n```bash\ncomposer require phlak/strgen\n```\n\nUsage\n-----\n\n```php\n// Import StrGen\nuse PHLAK\\StrGen;\n\n// Initialize the Generator\n$generator = new StrGen\\Generator();\n\n// Generate a random string of characters\n$generator-\u003elength(16)-\u003egenerate(); // Returns something like '8a*Ag@I0*s0v[S3u'\n```\n\n### Character Sets\n\nStrGen has a few built-in character sets available for ease of use. You can\nspecify which set(s) to use by passing a character set or an array of sets to\nthe `charset()` method.\n\n**Example using built-in sets:**\n\n```php\n$generator = new StrGen\\Generator();\n\n$generator-\u003echarset(StrGen\\CharSet::ALPHA_NUMERIC)-\u003egenerate();\n\n// or\n\n$generator-\u003echarset([StrGen\\CharSet::MIXED_ALPHA, StrGen\\CharSet::NUMERIC])-\u003egenerate();\n```\n\n**Available presets:**\n\n| Key                             | Character Set                |\n| ------------------------------- | ---------------------------- |\n| `StrGen\\CharSet::LOWER_ALPHA`   | `abcdefghijklmnopqrstuvwxyz` |\n| `StrGen\\CharSet::UPPER_ALPHA`   | `ABCDEFGHIJKLMNOPQRSTUVWXYZ` |\n| `StrGen\\CharSet::MIXED_ALPHA`   | `abcdefghijklmnopqrstuvwxyz`\u003cbr\u003e`ABCDEFGHIJKLMNOPQRSTUVWXYZ` |\n| `StrGen\\CharSet::NUMERIC`       | `0123456789` |\n| `StrGen\\CharSet::ALPHA_NUMERIC` | `abcdefghijklmnopqrstuvwxyz`\u003cbr\u003e`ABCDEFGHIJKLMNOPQRSTUVWXYZ`\u003cbr\u003e`0123456789` |\n| `StrGen\\CharSet::SPECIAL`       | `!@#$%^\u0026*()-_=+.?{}[]\u003c\u003e:;/\\\\|~` |\n| `StrGen\\CharSet::ALL`           | `abcdefghijklmnopqrstuvwxyz`\u003cbr\u003e`ABCDEFGHIJKLMNOPQRSTUVWXYZ`\u003cbr\u003e`0123456789`\u003cbr\u003e`!@#$%^\u0026*()-_=+.?{}[]\u003c\u003e:;/\\\\|~` |\n\n**Custom sets:**\n\nYou can also manually define a character set by passing a string of characters\nto the `charset()` method.\n\n```php\n$generator = new StrGen\\Generator();\n\n$generator-\u003echarset('0123456789abcdef')-\u003egenerate();\n```\n\n### Convenience Functions\n\nStrGen also has built-in convenience functions for generating strings from the\nincluded character sets or a custom character set.\n\n```php\n$generator-\u003elowerAlpha($length);\n$generator-\u003eupperAlpha($length);\n$generator-\u003emixedAlpha($length);\n$generator-\u003enumeric($length);\n$generator-\u003ealphaNumeric($length);\n$generator-\u003especial($length);\n$generator-\u003eall($length);\n$generator-\u003ecustom($length, $charset);\n```\n\nChangelog\n---------\n\nA list of changes can be found on the [GitHub Releases](https://github.com/PHLAK/StrGen/releases) page.\n\nTroubleshooting\n---------------\n\nFor general help and support join our [Spectrum community](https://spectrum.chat/phlaknet).\n\nPlease report bugs to the [GitHub Issue Tracker](https://github.com/PHLAK/StrGen/issues).\n\nCopyright\n---------\n\nThis project is licensed under the [MIT License](https://github.com/PHLAK/StrGen/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphlak%2Fstrgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphlak%2Fstrgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphlak%2Fstrgen/lists"}